參考自PetShop4.0
LOR: #000000">+ strWhere);
}
strSql.Append(" order by CategoryID ");
SqlDataReader rdr = DataAccess.SQLServerDAL.DbHelperSQL.ExecuteReader(strSql.ToString());
while (rdr.Read())
{
DataAccess.Model.Category cat =
new DataAccess.Model.Category(int.Parse(rdr[0].ToString()),
rdr[1].ToString(),
int.Parse(rdr[2].ToString()),
rdr[3].ToString(),
DateTime.Parse(rdr[4].ToString()));
綁定數據
List<DataAccess.Model.Category> categories = GetCategorIEs("ParentID=0");
Response.Write(newcat.CategoryName);
this.GridView1.DataSource = categorIEs;
this.GridVIEw1.DataBind();
查找數據
DataAccess.Model.Category newcat = categorIEs.Find(
delegate(DataAccess.Model.Category model)
{
return model.CategoryName == "Packaging Materials";
});