使用C#在Windows窗体中上载xls文件 [英] Uploade xls files in Windows forms using C#

查看:95
本文介绍了使用C#在Windows窗体中上载xls文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#

推荐答案

在windows foms上传excel文件步骤:

1)创建新项目(windows应用程序) ),

2)将DataGridView控件添加到表单中,

3)使用OleDbConnection [ ^ ], OleDbCommand [ ^ ]从Excel获取数据;要构建正确的连接字符串,请参见此处: http://www.connectionstrings.com/ [ ^ ]

4)使用 DataTable [ ^ ]作为 DataGridView.DataSource [ ^ ]。
Steps to do:
1) create new project (windows application),
2) add DataGridView control to your Form,
3) use OleDbConnection[^], OleDbCommand[^] to get data from Excel; to build correct connectionstring, see here: http://www.connectionstrings.com/[^]
4) use DataTable[^] as a source of your DataGridView.DataSource[^].


如果你想使用Excel文件在WinForms中,您可以使用此 .NET Excel Reader [ ^ ]从excel文件导出数据或 .Net Excel Writer [ ^ ]读/写/创建xls,xlsx,csv文件。
If you want to work with Excel files in WinForms you can use this .NET Excel Reader[^] to export data from excel files or this .Net Excel Writer[^] to read/write/create xls, xlsx, csv files.


这篇关于使用C#在Windows窗体中上载xls文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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