我需要在里面添加行:
dtbl = new DataTable();
dtbl.Columns.Add("Ad.No", typeof(String)); alignment[0] = 'C'; width[1] = 40;
dtbl.Columns.Add("AdmissionDate", typeof(String)); alignment[1] = 'C'; width[2] = 50;
dtbl.Columns.Add("Name", typeof(String)); alignment[2] = 'L'; width[3] = 100;
dtbl.Columns.Add("Class", typeof(String)); alignment[3] = 'C'; width[5] = 40;
for (int i = model.FromYear; i <= model.ToYear; i++)
{
for (int j = model.FromMonth; j <= model.ToMonth; j++)
{
for (int k = model.FromDay; k <= model.ToDay; k++)
{
dtbl.Columns.Add(Common.CommonUtility.GetShortMonthName(j)+" "+k, typeof(String)); alignment[4] = 'C'; width[5] = 40;
}
}
for (int i = model.FromYear; i <= model.ToYear; i++)
{
for (int j = model.FromMonth; j <= model.ToMonth; j++)
{
for (int k = model.FromDay; k <= model.ToDay; k++)
{
// dtbl.Rows.Add(dt[j]=std.value);
// foreach (var r in std.value){
dtbl.Rows.Add(dt["Ad.No"] = std.AdmissionNo, dt["AdmissionDate"] = Convert.ToDateTime(std.date.ToString()).ToString("dd/MM/yyyy"), dt["Class"] = std.Class, dt["Name"] = std.StudentName,dt[j]=std.value);
}
}
我需要在列单元格中添加行,例如p A p A。
std
是什么类型的数据?它是表格中一行的数据吗? - Martin StaufcikDataRow
实例,同时将其添加到DataTable
中,但是没有迹象表明您已经创建了一个新的DataRow
实例。) - Richard