//创建DataSet
System.Data.DataSet objSet = new DataSet();
//创建DataTableSystem.Data.DataTable objTable = new DataTable("test"); objTable.Columns.Add("CodeID", typeof(string)); objTable.Columns.Add("FilterCitem ", typeof(string)); objTable.Columns.Add("FilterSqlStr", typeof(string)); //创建DataRowSystem.Data.DataRow dr = objTable.NewRow(); dr[0] = "row0andcol0"; dr = "row2andcol2"; dr = "row3andcol3"; objTable.Rows.Add(dr); objSet.Tables.Add(objTable); //绑定数据源this.DataGrid.DataSource = objSet.Tables["test"]; this.DataGrid.DataBind();