日期:2014-05-18 浏览次数:20802 次
public static DataTable DataTableShow() { DataTable dt = new DataTable(); dt.Columns.Add("姓名", typeof(string)); dt.Columns.Add("年龄", typeof(string)); DataRow dr = null; dr = dt.NewRow(); dr["姓名"] = "kitty"; dr["年龄"] = "5"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["姓名"] = ""; dr["年龄"] = ""; dt.Rows.Add(dr); dt.Rows[1]["姓名"] = "我有姓名了!"; dt.Rows[1]["年龄"] = "我有年龄了!"; return dt; }