Don't know what your use is here, if it is a programming need, it needs to be implemented through the appropriate API. Various programming languages provide different ways and means. The simplest is Microsoft's own in the .net development environment provides a dynamic connection library interface with dll
Don't know if you are doing .net programming, the following answer may be useful to you, I used to do it, it should be effective for big data
Some systems may need to export the data to the Access or Excel file format, in order to easily transferring data, printing, etc.
Excel file or Access, the two need to export the file may not be pre-existing, which requires us to generate their own programming, the following collate some of the methods to generate these two files, only the most commonly used list. And not all.
One, the first generation of Excel files.
Program 1, if you use Excel to save just two-dimensional data, that is, to use him as a database.
The simplest, you do not have to refer to any additional components, just use OLEDB can be completed to create Excel files. Example code is as follows.
using System.Data.OleDb; public static void CreateExcelFile2() ... { string OLEDBConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\aa2.xls;"; OLEDBConnStr += " Extended Properties=Excel 8.0;"; string strCreateTableSQL = @" CREATE TABLE "; strCreateTableSQL += @" Test Table "; strCreateTableSQL += @" ( "; strCreateTableSQL += @" ID INTEGER, "; strCreateTableSQL += @" UserID INTEGER, "; strCreateTableSQL += @" UserIP VARCHAR , "; strCreateTableSQL += @" POSTTIME DATETIME , "; strCreateTableSQL += @" FromParm VARCHAR "; strCreateTableSQL += @" ) "; OleDbConnection oConn = new OleDbConnection(); oConn.ConnectionString = OLEDBConnStr; OleDbCommand oCreateComm = new OleDbCommand(); oCreateComm.Connection = oConn; oCreateComm.CommandText = strCreateTableSQL; oConn.Open(); oCreateComm.ExecuteNonQuery(); oConn.Close();}
using System.Data.OleDb; public static void CreateExcelFile2() ... { string OLEDBConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\aa2.xls;"; OLEDBConnStr += " Extended Properties=Excel 8.0;"; string strCreateTableSQL = @" CREATE TABLE "; strCreateTableSQL += @" Test Table "; strCreateTableSQL += @" ( "; strCreateTableSQL += @" ID INTEGER, "; strCreateTableSQL += @" UserID INTEGER, "; strCreateTableSQL += @" USERIP VARCHAR , "; strCreateTableSQL += @" POSTTIME DATETIME , "; strCreateTableSQL += @" FromParm VARCHAR "; strCreateTableSQL += @" ) "; OleDbConnection oConn = new OleDbConnection(); oConn.ConnectionString = OLEDBConnStr; OleDbCommand oCreateComm = new OleDbCommand(); oCreateComm.Connection = oConn; oCreateComm.CommandText = strCreateTableSQL; oConn.Open(); oCreateComm.ExecuteNonQuery(); oConn.Close();}
At the same time you execute the creation of the table, the system automatically completes the creation of the Excel file if it finds that the Excel file does not exist. This is something that people who haven't touched it might not realize.
As for the addition and modification of which operation, with the ordinary database is no different, will not describe.
You can refer to the following article:
blogs.com/meyer/archive/2004/12/08/6977.html
Option 2, directly generate a plain text file using spacing symbols to separate each item of data, but the file suffix is XLS.
Note: At this time, if you directly use Excel to open such a file, no problem, everything is normal, but if you use ADO.net to read this file, your link engine should not be Excel, but the text file (Microsoft Text Driver). That is, the link string should not be
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\aa2.xls;Extended Properties=Excel 8.0;"
And it should be the following way:
OLEDB way to connect to the string:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\\11.txt;Extended Properties='text;HDR=No;FMT=TabDelimited'
< p>ODBC way to read TXT string write:Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=C:\\\11.txt;Extensions=asc,csv,tab,txt;
Please refer to the following article:
< p>/Cpp/Cpp/cpp_managed/nfc/print.php/c8299/Option 3, you want to create an Excel file, there are some of Excel's own features need to be created, which requires the use of Com, that is, the Microsoft Excel Object Library
Please add Microsoft Excel 11.0 Object Library reference to it, according to the version of Office you installed, the version of this component library is not the same.Example code:
public static void CreateExcelFile() ... { string FileName = "c:\\aa.xls"; Missing miss = Missing.Value; Excel.Application m_objExcel = new Excel.Application(); m_objExcel.Visible = false ; Excel.Workbooks m_objBooks = (Excel.Workbooks)m_objExcel.Workbooks; Excel.Workbook m_objBook = (Excel.Workbook)(m_objBooks.Add(miss)); m_ objBook.SaveAs(FileName, miss, miss, miss, miss, miss, miss, Excel.XlSaveAsAccessMode.xlNoChange, miss, miss,miss, miss, miss); m_objBook.Close( false, miss, miss); m_objExcel.Quit(); }
I've simply created the Excel file here without manipulating Excel more, if you wish to see more how to do this, please refer to the following articles:
/default.aspx?scid=kb;en -us;306023&Product=vcSnet#6
/kb/317881/EN-US/
.net/study/program/vb/1049955696.html