0

我一直在尝试使用以下代码从 oracle 数据库中查询,

public DataSet SelectCustomerDetails(string CustCode)
{

    String SQL = @"select cust.name,cust.code,cust.caddr from  cust
     where cust.code = '{0}'";

     OleDbConnection connection = new OleDbConnection();
     connection.ConnectionString =System.Configuration. ConfigurationManager.ConnectionStrings["OracleDB"].ConnectionString;
      connection.Open();

     SQL = string.Format(SQL, CustCode);
     OleDbDataAdapter DA = new OleDbDataAdapter(SQL, connection);

     DataSet CustDataSet = new DataSet();
     CustDataSet.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
     DA.Fill(CustDataSet);
     connection.Close();
}

我确信在这个方法调用中,我会随机收到错误“现有连接被远程主机强制关闭”。这个问题可能是什么原因。 在此处输入图像描述

4

0 回答 0