问题补充:using Oracle.DataAccess.Client; 已经成功引用
private void btnTestConnections_Click(object sender, EventArgs e)//按钮事件
{
string connectionString = "Data Source=XXXX;user=XXXX;password=XXXX";//连接字符串正确
OracleConnection oc = new OracleConnection(connectionString);
oc.Open();
string sql = "select * from goodsbase where GBID='00901002'";
OracleCommand ocom = new OracleCommand(sql, oc);
OracleDataReader reader = ocom.ExecuteReader();
string a = "";
if (reader.HasRows)
{
if (reader.Read())
{
a = (string)reader["GBID"];
}
}
this.lblLastGenerationDate.Text = a;
reader.Close();
oc.Close();
}运行起来,当我单机按钮时报此异常。
private void btnTestConnections_Click(object sender, EventArgs e)//按钮事件
{
string connectionString = "Data Source=XXXX;user=XXXX;password=XXXX";//连接字符串正确
OracleConnection oc = new OracleConnection(connectionString);
oc.Open();
string sql = "select * from goodsbase where GBID='00901002'";
OracleCommand ocom = new OracleCommand(sql, oc);
OracleDataReader reader = ocom.ExecuteReader();
string a = "";
if (reader.HasRows)
{
if (reader.Read())
{
a = (string)reader["GBID"];
}
}
this.lblLastGenerationDate.Text = a;
reader.Close();
oc.Close();
}运行起来,当我单机按钮时报此异常。
下载了一个system.Oracle.Client.dll的文件2.0框架下的。然后连接字符串改了改。后来再运行就好了。谢谢各位的帮助。