如何使用数据集显示2个表中的数据? [英] How to display data from 2 tables using dataset?

查看:100
本文介绍了如何使用数据集显示2个表中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



仅仅是为了学习目的,我想知道。如何使用数据集显示来自2个表格的数据



我是否需要使用此程序或通过常规方式我们可以使用2个表格。

i想要在两个单独的网格视图中显示表。


For just studying purpose i want to know. How to display data from 2 tables
using dataset.
Do i need to use procedure for this or by conventional way we can use 2 tables.
i want to display tables in two separate grid views.

推荐答案

如果数据集中有两个表,则可以使用



if you have two tables in your dataset, you can get data in each table by using

DataTable dt1 = dataset.Tables[0];
DataTable dt2 = dataset.Tables[1];



或者您可以使用表名来代替指数。现在您有了数据表,您可以将每个数据表设置为数据源或网格视图。


or you can use table name instead of index. Now you have the data tables and you can set each data table as data source or your grid views.


这篇关于如何使用数据集显示2个表中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆