代码示例:
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn ClassID = new DataColumn("ClassID", typeof(int));
DataColumn ClassName = new DataColumn("ClassName", typeof(string));
dt.Columns.Add(ClassID);
dt.Columns.Add(ClassName);
DataRow dr = dt.NewRow();
dr["ClassID"] = "1";
dr["ClassName"] = "AAAA";
DataRow dr2 = dt.NewRow();
dr2["ClassID"] = "2";
dr2["ClassName"] = "BBBB";
dt.Rows.Add(dr);
dt.Rows.Add(dr2);
ds.Tables.Add(dt);