小弟我新手,看见一个例子代码如下:
DataSet ds = new DataSet();
myCommand.Fill(ds);
// Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the
// DataGrid control in the HTML section.
DataView source = new DataView(ds.Tables[0]);
DataGrid.DataSource = source ;
DataGrid.DataBind();他这里用的是ds.Tables[0],我如果再加类似如下代码:
anotherCommand.Fill(ds)
那么我anotherCommand查询得到的表是否是ds.Tables[1]?
DataSet ds = new DataSet();
myCommand.Fill(ds);
// Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the
// DataGrid control in the HTML section.
DataView source = new DataView(ds.Tables[0]);
DataGrid.DataSource = source ;
DataGrid.DataBind();他这里用的是ds.Tables[0],我如果再加类似如下代码:
anotherCommand.Fill(ds)
那么我anotherCommand查询得到的表是否是ds.Tables[1]?
解决方案 »
- C#中简单工厂模式非常重要?
- Client unable to establish Connection
- 调用DLL的问题,很急很急。。。
- 如何实现选择文件的控件属性
- VS2005下怎么运行C#程序
- 我建一个资源文件Resource1.resx,里面有图标,如果把相应的图标对应到TreeView中的SelectedImageIndex属性呀/
- Dns.GetHostEntry("www.baidu.com")运行该语句时候报异常错误,跪求大神帮忙看看
- 请问一下,原来有一编写关于公司为什么要用.net的文章在哪个地方
- 出现异常
- 菜鸟问题:
- 有关DataGrid checkbox问题
- 求教:hashtable里读出来的顺序为什么会不同?
myCommand.Fill(ds, yourTableName );//Fill table with nameDataView source = new DataView(ds.Tables[yourTableName]);//Create data view using name.
那么我anotherCommand查询得到的表是否是ds.Tables[1]?如果想放到一起,按照我上面提的,用同一个表名即可,如果不想放到一起,用另外一个表名。
这样程序看得很清楚。
方法就是楼上的那样。
this.sqldataadapter1.fill(this.dataset1,"myTablename")调用就简单了:
dataview source=this.dataset1.table["myTablename"].defaultview;