Solution to oledbconnection reading Excel Data null

Source: Internet
Author: User

Connection string:

Adoconnection1.connectionstring: = 'provider = Microsoft. Jet. oledb.4.0; Data Source = '+
Edit1.text + '; extended properties = "Excel 8.0; IMEX = 1; HDR = yes"; persist Security info = true ';

1. The extended attributes in the Excel connection string must contain IMEX = 1;

2. Modify the value of HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ jet \ 4.0 \ engines \ Excel \ typeguessrows in the Registry to 0. The default value of typeguessrows is 8, which indicates that the system samples the data type from the first eight rows of data in the file. If the first eight rows contain numbers and text, the Data Type of the sample is large. For example, if the first eight rows contain 5 rows of numbers and 3 rows of text, 5 rows of numbers are returned, and 3 rows are empty. If there are four rows of numbers and four lines of text, four rows of numbers are returned. The four rows are empty. If the data types after 8 rows are the same as those of the sampling type, the actual data is returned. Otherwise, null is returned.
 

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.