1.创建
public static DataTable CreateNewTable() { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[] { new DataColumn("tmstamp",typeof(DateTime)), new DataColumn("operator",typeof(string)), new DataColumn("deviceid",typeof(int)), new DataColumn("message",typeof(string)), }); return dt; }
2.添加数据
this.gcProjectOrSaleExpense.DataSource = ExpensesHelper.NewProjectOrSaleExpenseDt()
this.gvDailyExpense.AddNewRow();