DateTable添加行

DataTable dt = new DataTable();
dt.Columns.Add("LogID", typeof(int));
dt.Columns.Add("CityNo", typeof(string));
dt.Columns.Add("OperateName", typeof(int));
dt.Columns.Add("Description", typeof(string));
dt.Columns.Add("CreateDate", typeof(DateTime));

//dt =
int count = dt.Rows.Count;
if (count < 100)
{
    for (int i = 1; i < 100 - count; i++)
    {
        DataRow row = dt.NewRow();

        row["LogID"] = 1;
        row["CityNo"] = "350200";
        row["OperateName"] = "...";
        row["Description"] = "...";
        row["OperateName"] = DateTime.Now;

        dt.Rows.Add(row);
    }
}

posted @ 2010-08-01 16:14  libingql  阅读(609)  评论(0编辑  收藏  举报