datatable 转list 如何绑定到repeater
zbgdd 2012-03-12 05:02:55 public IList<user> ExecuteIList(string strSQL)
{
IList<user> myTable = new List<user>();
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(strSQL, connection);
connection.Open();
using (SqlDataReader rdr = SqlHelper.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rdr.Read())
{
user cat = new usr(rdr.GetString(0), rdr.GetString(1), rdr.GetString(2));
myTable.Add(cat);
}
}
return myTable;
}
上面的方法在repeater控件中如何使用