我在c#
中为oracle创建连接字符串下面是我的代码
OracleConnection cn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.5 )(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));User Id=nTireoffice ;Password=nTireoffice;");
DataTable dt = new DataTable();
string strSql = " select to_number (nvl(max(nvl(Region_ID ,0)),0)+1 ) as No from BO_REGION_MASTER ;";
cn.Open();
OracleDataAdapter objSda = new OracleDataAdapter(strSql, cn);
objSda.Fill(dt);
string s = dt.Rows[0][0].ToString();
抛出异常ORA-06413:连接未打开。
我正在使用Windows 8企业64位操作系统
谢谢你...答案 0 :(得分:0)
答案 1 :(得分:0)
我已经创建了这样的连接。
ora_cmd = new OracleCommand();
ora_con = new OracleConnection("Data Source={YOUR_HOST}:{YOUR_PORT}/{YOUR_DB};Persist Security Info=True;User ID={YOUR_ID};Password={YOUR_PASSWORD};Pooling=True;Max Pool Size=200;");
ora_cmd.Connection = ora_con;
ora_connect.Open();
然后使用ora_cmd执行语句