我创建了一个包含三个字段的数据表,即TimeTask,TaskItem和Count(用户数),例如; {“12:30 AM-01:00AM”,T1,3}。
dataTable.Columns.Add("Task Time", typeof(string));
dataTable.Columns.Add("Task", typeof(string));
dataTable.Columns.Add("Count", typeof(int));
dataTable.Rows.Add("12:00AM-12:15AM", "T1", 6);
dataTable.Rows.Add("12:45AM-01:00AM", "T1", 5); dataTable.Rows.Add("01:00AM-01:15AM", "T1", 1);
dataTable.Rows.Add("01:15AM-01:30AM", "T2", 4);
dataTable.Rows.Add("01:30AM-01:45AM", "T2", 9);
GridView1.DataSource = dataTable;
GridView1.DataBind();
In this there is no task for the TimeTask "12:15AM-12:30AM" and "12:30AM-12:45AM" yet the TimeTask should be inserted as,
TimeTask TaskItem计数
凌晨12点至12点15分T1 6
上午12:15-12:30 - -
12:30 AM-12:45 AM - -
12:45 AM-01:00AM T1 5
凌晨01:00 01:15 AM T1 1
01:15 AM 01:30AM T2 4
01:30 AM 01:45 AM T2 9
如何查找丢失的行?是否可以在此场景中动态插入现有DataTable(无数据源)中的行。请帮助。谢谢: - )
答案 0 :(得分:0)
DataRow dr = dt.NewRow();
dr["Task Time"] = ....;
dr["Task"] = ....;
dr["Count"] = ....;
dt.Rows.Add(dr);
应该做的伎俩。