日期:2014-05-17 浏览次数:20861 次
public List<Customer> GetALL()
{
List<Customer> customers = new List<Customer>();
customers=SqlHelper.ExcuteReader("select * from T_Customer");//就是在这里抛出异常的,可是SqlHelper是个静态类啊
return customers;
}
public static List<Customer> ExcuteReader(string str, params SqlParameter[] para)
{
using (SqlConnection sql = new SqlConnection(connection))
{
sql.Open();
using (SqlCommand com = sql.CreateCommand())
{
com.CommandText = str;
com.Parameters.AddRange(para);
using(SqlDataReader reader=com.ExecuteReader())
{
if (reader==null)
{
return null;
}
List<Customer> customers=new List<Customer>();