环保空调怎么用:asp.net2.0的数据对象中如何插入一列?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 17:15:24
菜鸟提问,说的不清楚请不要鄙视,呵呵。
从数据库中查询来的结果只有3个列,我想变成4个列,并给第4列赋值。
c#不知道是不是这段:
public DataSet FillDataSet(string key)
{
string commandText = "select * from test where test like '%" + key + "%'";
DataSet ds = this.BuildDataSet("test");
da.SelectCommand.CommandText = commandText;
da.Fill(ds, "test");
return ds;
}
public DataSet BuildDataSet(string tableName)
{
DataTable table = new DataTable(tableName);
DataSet ds = new DataSet();
table.Columns.Add("id", typeof(System.Int32));
table.Columns.Add("test", typeof(System.String));
table.Columns.Add("chk", typeof(System.Boolean)).DefaultValue = false;
table.PrimaryKey = new DataColumn[1] { table.Columns[0] };//设置主键
ds.Tables.Add(table);
return ds;
}
我需要的是vb代码,请高手帮忙,拜谢!代码中多处用到了test,最好能帮我区别开来。