从两张Excel工作簿中读取数据,并以Windows窗体在gridview中显示 [英] Read the data from two excel work book and display in gridview in windows form

查看:88
本文介绍了从两张Excel工作簿中读取数据,并以Windows窗体在gridview中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个桌子
客户表字段是(客户编号,名字,姓氏)和订单表字段是(订单编号,项目,客户编号)这两个表在两个不同的excel工作簿中.
我想在".Net"中开发一个独立的应用程序.如何使用自定义编号从两个Excel工作表中读取数据并显示在单个表中的数据中?

客户无姓氏
101哈里·基山
102 kiran kumar
订单号项目客户编号
1001 Rin 101
1002 lux 101
1003 Rin 102
显示
客户没有名字姓氏没有订单
101 hari kirshna 1001 in
101 hari kirshna 1002 lux

I have two tables
Customer table fields are (Customer no , first name, last name) and Order table fields are (Order no, item, customer no) these two tables in two different excel work books.
I want to develop one standalone application in ".Net". How can I read the data from two excel sheet and display in data in single table using custom no?

Customer no first name lastname
101 hari kirshan
102 kiran kumar
Order no item customer no
1001 Rin 101
1002 lux 101
1003 Rin 102
To display
Customer No first name lastname order no item
101 hari kirshna 1001 Rin
101 hari kirshna 1002 lux

推荐答案

签出 [ ^ ]链接.
它是针对Web应用程序的,但是您可以轻松地参照此进行Windows应用程序.

您必须使用上述方法从两个Excel文件中填充两个数据表.
此外,还必须在这两个表之间创建DataRelation.
最后创建一个结合了两个表的DataView对象,并将其绑定到DataGrid.
Check out this[^] link.
It is for web application but you can easily do your windows application refering this.

You have to fill two datatables from two excel files using above method.
Also, you have to create DataRelation between these two tables.
Finally create a DataView object combining both tables and bind it to DataGrid.


这篇关于从两张Excel工作簿中读取数据,并以Windows窗体在gridview中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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