ExecuteReader
public SqlDataReader GetDataSetBySql(string str)
{
try
{
objSqlCon.Open();
objSqlCom = new SqlCommand(str, objSqlCon);
objSqlCom.CommandType = CommandType.Text;
objSqlDataReader = objSqlCom.ExecuteReader;
return objSqlDataReader;
}catch (Exception e2)
{
Console.WriteLine(e2.Message);
}
finally
{
if (objSqlCon != null)
{
objSqlCon.Close();
}
}
}
错误提示无法将ExecuteReader转换为非委托类型System.Data.SqlCilent.SqlDataReader. 并问我您是要调用方法么?
------解决方案--------------------objSqlDataReader = objSqlCom.ExecuteReader;
==
objSqlDataReader = objSqlCom.ExecuteReader();
------解决方案--------------------ExecuteReader是个方法唉
------解决方案--------------------