好几次都遇到了DATASET的问题,于是把它实例的具体过程写出来,^_^我是个初学者
大家多多关照
//创建DataSet
System.Data.DataSet objSet = new DataSet();
//创建DataTable
System.Data.DataTable objTable = new DataTable("test");
objTable.Columns.Add("CodeID", typeof(string));
objTable.Columns.Add("FilterCitem ", typeof(string));
objTable.Columns.Add("FilterSqlStr", typeof(string));
//创建DataRow
System.Data.DataRow dr = objTable.NewRow();
dr[0] = "row0andcol0";
dr[1] = "row2andcol2";
dr[2] = "row3andcol3";
objTable.Rows.Add(dr);
objSet.Tables.Add(objTable);
//绑定数据源
this.DataGrid.DataSource = objSet.Tables["test"];
this.DataGrid.DataBind();
System.Data.DataSet objSet = new DataSet();
//创建DataTable
System.Data.DataTable objTable = new DataTable("test");
objTable.Columns.Add("CodeID", typeof(string));
objTable.Columns.Add("FilterCitem ", typeof(string));
objTable.Columns.Add("FilterSqlStr", typeof(string));
//创建DataRow
System.Data.DataRow dr = objTable.NewRow();
dr[0] = "row0andcol0";
dr[1] = "row2andcol2";
dr[2] = "row3andcol3";
objTable.Rows.Add(dr);
objSet.Tables.Add(objTable);
//绑定数据源
this.DataGrid.DataSource = objSet.Tables["test"];
this.DataGrid.DataBind();