代码是这样写的
public DataSet Query(string sqlString)
{
DataSet result = null; ;
using (IDbConnection iConn = this.GetConnection())
{
using (IDbCommand iCmd = GetCommand(sqlString, iConn))
{
DataSet ds = new DataSet();
iConn.Open();
try
{
IDataAdapter iAdapter = this.GetAdapater(iCmd);
iAdapter.Fill(ds);//报错
result = ds;
}
catch (System.Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
if (iConn.State != ConnectionState.Closed)
{
iConn.Close();
}
}
}
}
return result;
}
开始以为是方法用错了,或者是参数传错了,都试了一遍后发现是 是执行的那个sql语句有问题,因为浪费了很多时间,所以必须记录一下