调用方法:
using (IDataReader dr = DbHelper.ExecuteReader(strSql))
{
while (dr.Read())
{
// 赋值
}
dr.Close();
}
公共方法:
public static IDataReader ExecuteReader(string strSql)
{
SqlConnection con = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand(strSql, con);
con.Open();
SqlDataReader reader = command.ExecuteReader();
return reader;
}