更新时间:2023-02-11 09:25:21
在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.