I added several DataTables to one DataSet, and want to display this DataSet on DataGrid.But it only display the first DataTable. How can I display all the DataTables on one DataGrid?Different DataTable have different columns, and some of them do not have any relations.Any advice or good idea? Thanks a lot!
解决方案 »
- 用C#操作USB接口
- C#调用C++的DLL用StringBuilder获取返回值,不指定StringBuilder大小会出现乱码
- 求助:VS 2005 C# 编写PPC程序时,怎么让光标跳出TextBox,选择控制其它Button控件呢?
- 【求教】取平均值
- 关于副窗口删除数据主窗口自动刷新问题
- Vista风格日历控件C#源码! 【继续散分】
- dataGridView 动态添加列问题
- 安全性异常,请问这个权限在哪设置? 十分感谢!
- 高手进来:下面这段程序错在哪里?
- .net2005中哪个容器有滚动条属性?
- winform 中 datagrid 单击选中整行 而不是单元格
- 关于2005安装后的问题
DataGrid1.DataBind();
DataGrid1.DataBind();ok?
SqlDataCommand str1=new SqlDataCommand("select * from Categories",connection);
SqlDataCommand str2=new SqlDataCommand("select * from Employees",connection);
SqlDataCommand str3=new SqlDataCommand("select *from Customers",connection);
SqlDataAdapeter da=new SqlDataAdapter();
DataSet ds=new DataSet();
connection.open();
da.SelectCommand=str1;
da.Fill(ds,"table1");
da.SelectCommand=str2;
da.Fill(ds,"table2");
da.SelectCommand=str3;
da.Fill(ds,"table3");
//........
列名无所谓的,相同的话改个名,再把DataColumn.Caption设为原来的列名
grid1.DataSource = dataset1;
http://www.syncfusion.com/faq/windowsforms/search/780.aspx
Since these tables are search results, you should get breaf info from results to create an index table which will be shown in datagrid.
DataGrid1.DataBind();就行了