.net连接oracle数据库

一、string strConnString = "Data Source=ORCL;User Id=admin;Password=ad
min;";

Oracle.DataAccess.Client.OracleConnection OraCnn = new Oracle.DataAccess.Client.OracleConnection();

OraCnn.ConnectionString = strConnString;

try

{ OraCnn.Open();

MessageBox.Show("连接成功");

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

finally

{ OraCnn.Dispose();

}
二、string strConnString = "Data Source=ORCL;User Id=admin;Password=admin;";

System.Data.OracleClient.OracleConnection OraCnn = new System.Data.OracleClient.OracleConnection(strConnString);

try

{

OraCnn.Open();

MessageBox.Show("连接成功");

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

finally

{

OraCnn.Dispose();

}
为什么“一”连接失败,显示错误消息“用户名或密码错误”,“二”可以登录成功?怎么解决呢?望各位大神赐教

1个回答

ccess.Client.OracleConnection OraCnn = new Oracle.DataAccess.Client.OracleConnection();

OraCnn.ConnectionString = strConnString;

try

{ OraCnn.Open();

MessageBox.Show("连接成功");

}

catch (Exception ex)

{

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问