read and write excel file as a table
2004-05-20 11:40
671 查看
string strFileName = "c:\***.xls";
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFileName + ";Extended Properties=Excel 8.0;";
System.Data.OleDb.OleDbConnection EConn=new System.Data.OleDb.OleDbConnection(strConn);
EConn.Open();
System.Data.OleDb.OleDbCommand ECmd=new System.Data.OleDb.OleDbCommand();
ECmd.Connection = EConn;
ECmd.CommandText = "SELECT * FROM myRange";
"myRange" in SQL is the name of the range you have selected in Excel file.
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFileName + ";Extended Properties=Excel 8.0;";
System.Data.OleDb.OleDbConnection EConn=new System.Data.OleDb.OleDbConnection(strConn);
EConn.Open();
System.Data.OleDb.OleDbCommand ECmd=new System.Data.OleDb.OleDbCommand();
ECmd.Connection = EConn;
ECmd.CommandText = "SELECT * FROM myRange";
"myRange" in SQL is the name of the range you have selected in Excel file.
相关文章推荐
- Read a Text File with VBA in Excel, and Write the Text to a Spreadsheet
- Read and write excel file with format by pandas and xlwt libraries of python
- Android Study Day 3 --Android File Read And Write
- Java Excel API - A Java API to read, write and modify Excel(收集)
- How to mount partition with ntfs file system and read write access
- How to mount partition with ntfs file system and read write access
- Read ALAsset movie file and write into the disk
- read numbers from file and exchange their positions then write into another file
- Win32 WriteFile and ReadFile
- Qt Write and Read XML File 读写XML文件
- Read and Write NSArray, NSDictionary and NSSet to a File
- Spring Batch Read from DB and Write to File
- [zz] Read and write a properties file
- Create, Read, Write, Copy, Move and Delete a Text File using C# and VB.NET
- [C++]C++小笔记之Simple File read and write-- ofstream and ifstream
- Ubuntu Read and Write NetCDF file
- BasicExcel - A Class to Read and Write to Microsoft Excel
- Read and write a FileStream at the same time
- Something about file's read and write (C++)
- jxl read and write excel