如何在一个datagridview中加载数据库多个表 [英] how to load database multiple tables in one datagridview

查看:298
本文介绍了如何在一个datagridview中加载数据库多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在datagridview上加载数据库多个表数据。



i有创建了一个win应用程序,它在按钮点击事件中将数据从textbox和datagridview插入数据库。



但现在我想在datagridview中检索特定的ID信息行数据。 />


每个表在表中有一个公共列



例如,如果我们在文本框中提供ID,它应该检索datagriedview中的多个表数据。



任何人都可以帮我提供示例代码。





谢谢

sam.198979

Hi,

I want to load the database multiple tables data on datagridview.

i have created a win application which insert data from textbox & datagridview to database on button click event.

but now i want to retrieve particular ID info rows data in datagridview.

each table have one common column in table

for example if we give ID in textbox it should retrieve the multiple tables data in datagriedview.

can anyone help me with sample code.


thanks
sam.198979

推荐答案

嗨Sam,

从表中获取数据分离数据集,将这些数据集合并到一个公共数据集中。然后将数据集绑定到网格..

否则

您可以创建SQL视图通过从所有不同的数据库表中选择,您需要获取
然后从中获取视图和创建数据集或通用列表(你感到满意)绑定到网格。
Hi Sam,
Fetch data from the tables in to separate data sets,combine these data set in to one common data set .then bind the data set to the grid ..
OR else
You can create a SQL View by selecting from all the different database tables you have
then fetch from the view and create data set or generic list (what ever you are comfortable with) bind to grid .


这篇关于如何在一个datagridview中加载数据库多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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