Database connection Parameters

Source: Internet
Author: User
Tags ole

One, Microsoft Excel

1 Microsoft ACE OLE DB 12.0

1.1 Xlsx Files

Connect to Excel (and later) files with the Xlsx file extension. That's the Office Open XML format with macros disabled.

Provider=Microsoft.ACE.OLEDB. 12.0;D ata Source=c:\myFolder\myExcel2007file.xlsx; Extended Properties=12.0Xml; HDR=YES ";

"Hdr=yes;" indicates that first row contains columnnames, not data. "Hdr=no;" indicates the opposite.

1.2 Treating data as text

The use of this one is want to treat all data in the file as text, overriding Excels column type ' General ' to guess what Ty PE of data is in the column.

Provider=Microsoft.ACE.OLEDB. 12.0;D ata Source=c:\myFolder\myExcel2007file.xlsx; Extended Properties=12.0Xml; HDR=YES; imex=1";
    • If you want to read the column headers into the result set (using Hdr=no even though there is a header) and the column dat A is numeric, with imex=1 to avoid crash.
    • Imex=1 is a safer-to-retrieve data for mixed data columns. Consider the scenario that one Excel file might work fine cause that file's data causes the driver to guess one data type While another file, containing other data, causes the driver to guess another data type. This can cause your app to crash.

1.3 Xlsm Files

Connect to Excel (and later) files with the Xlsm file extension. That's the Office Open XML format with macros enabled.

Provider=Microsoft.ACE.OLEDB. 12.0;D ata Source=c:\myFolder\myExcel2007file.xlsm; Extended Properties=12.0Macro; HDR=YES ";

1.4 Excel 97-2003 Xls files with ACE OLE DB 12.0

You can use this connection string to use the Office for OLE DB driver (ACE 12.0) to connect to older 97-2003 Excel WORKBO OKs.

Provider=Microsoft.ACE.OLEDB. 12.0;D ata Source=C:\myFolder\myOldExcelFile.xls; Extended Properties=8.0; HDR=YES ";

Database connection Parameters

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.