我有两个表,你怎么能在datagridview中一起显示它们? [英] i have two tables,how can u show them together in datagridview?
本文介绍了我有两个表,你怎么能在datagridview中一起显示它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个表,如何在datagridview中一起显示它们?
推荐答案
I我不确定你的意思,但是......
DataSource [ ^ ]属性 DataGridView [ ^ ](DGV)接受DataTable [ ^ ]宾语。这意味着您可以在一个查询中从不同的表中获取数据:
I'm not sure what you mean, but...
DataSource[^] property of DataGridView[^] (DGV) accepts DataTable[^] object. It means you can fetch data from different tables in one query:
SELECT t1.*, t2.*
FROM t1 INNER JOIN t2 ON t1.key = t2.key
但是如果你使用 GridView [ ^ ](ASP.NET)并希望在另一个GV上显示相关记录,请阅读嵌套网格视图 [ ^ ]。
But if you use GridView[^] (ASP.NET) and want to display related records on another GV, please read about nested gridview[^].
如果两个表具有相同的结构,那么您可以合并它们并绑定到DataTable。
参考在datagridview中加载2个数据表 [ ^ ]。
If both the Tables have same structure, then you can merge them and bind to the DataTable.
Refer answers at load 2 datatables in a datagridview[^].
这篇关于我有两个表,你怎么能在datagridview中一起显示它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文