DATATABLE添加行失败,哪里写错了?
Haten 2007-12-21 03:42:02 DataTable work1Table = new DataTable("GZ");
work1Table.Columns.Add("列1", typeof(string));
work1Table.Columns.Add("列2", typeof(string));
work1Table.Columns.Add("列3", typeof(string));
work1Table.Columns.Add("列4", typeof(string));
work1Table.Columns.Add("列5", typeof(string));
work1Table.Columns.Add("列6", typeof(string));
work1Table.Columns.Add("列7", typeof(string));
work1Table.Columns.Add("列8", typeof(string));
work1Table.Columns.Add("列9", typeof(string));
try
{
//增加行
for (n = 0; n < tmpStrCode.Length; n++)
{
DataRow rowvalues = work1Table.NewRow();
int m = 0;
tmpStrYS = GetInfoByCode(tmpStrCode[n]);
for (m = 0; m < tmpStrYS.Length; m++)
{
rowvalues[m] = tmpStrYS[m].ToString();
}
work1Table.Rows.Add(rowvalues);
}
return work1Table;
}
catch(Exception ex)
{
return null;
}