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);
    }
}

你可能感兴趣的:(table)