{
Gvmes.DataSource = GetDataTable();
Gvmes.DataBind();
{
DataTable dt = new DataTable("cart");
DataColumn dc1 = new DataColumn("prizename", Type.GetType("System.String"));
DataColumn dc2 = new DataColumn("point", Type.GetType("System.Int16"));
DataColumn dc3 = new DataColumn("number", Type.GetType("System.Int16"));
DataColumn dc4 = new DataColumn("totalpoint", Type.GetType("System.Int64"));
DataColumn dc5 = new DataColumn("prizeid", Type.GetType("System.String"));
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
dt.Columns.Add(dc3);
dt.Columns.Add(dc4);
dt.Columns.Add(dc5);
//以上代码完成了DataTable的构架,但是里面是没有任何数据的
for (int i = 0; i < 10; i++)
{
DataRow dr = dt.NewRow();
dr["prizename"] = "娃娃" + i.ToString();
dr["point"] = 10 + i;
dr["number"] = i;
dr["totalpoint"] = 10 + i;
dr["prizeid"] = "00" + i.ToString();
dt.Rows.Add(dr);
}
return dt;
}