问题补充: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();
}
运行起来,当我单机按钮时报此异常。
------解决方案--------------------------------------------------------
string sql = "select * from goodsbase where GBID='00901002'";去掉单引号试试