问题描述
- .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();
}
为什么“一”连接失败,显示错误消息“用户名或密码错误”,“二”可以登录成功?怎么解决呢?望各位大神赐教
时间: 2024-10-29 12:46:58