OracleConnection cn = new OracleConnection(Common.Class1.ConnectString);
Common.Class1.ConnectString不要加引号

解决方案 »

  1.   

    ConnectString本来就是个字符串吧  不用加""
      

  2.   

    把引号去掉了,再次运行时又出现:不支持关键字: “database”。
    是指common层里的代码吗?
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace Common
    {
        public class Class1
        {
            //cn
            public const String ConnectString = "server=localhost;database=xBlog;uid=adotest;password=adotest";        //Oracle
            public const String Oracle_getUser = "select *from Users";        //table
            public const String table_Users = "Users";        //storedprocedure
        }
    }
      

  3.   

    Oracle的连接字符串好象是用Data Source而不是Database吧
      

  4.   

    Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;Data Source=myOracle;User Id=myUsername;Password=myPassword;Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2;