The code for reading Excel Data with Microsoft. Jet. oledb.4.0 is as follows:String connstr = "provider = Microsoft. Jet. oledb.4.0; Data Source = C:/aa.xls; extended properties = 'excel 8.0; HDR = no; IMEX = 1 ';";Oledbconnection conn = new oledbconnection (connstr );Conn. open ();String SQL = "select * from [sheet1 $]";Oledbdataadapter da = new oledbdataadapter (SQL, connstr );Dataset DS = new dataset ();Da. Fill (DS );Datagrid1.datasource = Ds;Data
C # key points of reading and writing excel tables through OleDb,
1. connection string of OleDbConnection:
0 ffice 97-2003:
StrConnection = string. format ("Provider = Microsoft. jet. OLEDB.4.0; Data Source = {0}; Extended Properties = \ "Excel 8.0; HDR = {1}; IMEX = {2: D} \"; ", ExcelFilePath, HDR, IMEX );// HDR = No indicates that ADO will not use the first li
In the past, when reading an Excel file, some fields were often read as null values. In fact, some fields were actually null values, because when reading the file, Excel would take the data type of the first row as a reference, if they are different, some problems may occur.
The following is a solution. The connection string of the Excel file is written as follows. It is said that the data can be forced to be a string. I did not test it again. For reference only.
String strconn = "provider = M
;bd->bi_flashsize/(1024 * 1024); Thekernel (LINUX_ARGC, LINUX_ARGV, linux_env, flash_size_mbytes); /* Start the kernel, that is, start from the address of Ntohl (HDR->IH_EP) (This is not a function call, but instead run the object directly on this address; specifically kernel_ Entry), whose passed parameters are linux_argc, LINUX_ARGV, Linux_env, flash_size_mbytes*/ #else and in Linux/kernels/mips-linux-2.6.31/arch/mips/kernel/head. S , there are: NES
Excel|server
Basic ways to import/export Excel from SQL Server
/*=================== Import/Export Excel basic methods ===================*/
From the Excel file, import the data into the SQL database, very simply, using the following statement directly:
/*===================================================================*/
--If the table that accepts the data import already exists
INSERT INTO table SELECT * FROM
OPENROWSET (' MICROSOFT. JET. oledb.4.0 '
, ' Excel 5.0;
Tags: c # Excel OLE DB1,oledbconnection Connection string: 0ffice 97-2003: strconnection = string. Format ("Provider=Microsoft.Jet.OLEDB.4.0;Data source={0}; Extended properties=\ "Excel 8.0; Hdr={1};imex={2:d}\ ";", Excelfilepath, HDR, IMEX);Hdr=no indicates that ADO will not use the first line of your Excel file as the field name (this is the default field name
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.