Notes when importing Excel Data in. net

Source: Internet
Author: User
When importing data from an Excel file to a database, the most common method is to use Provider = Microsoft. Jet. oledb.4.0;
Data Source = D: "demo.xls; extended properties = 'excel 8.0; HDR = yes; IMEX = 1' . However, when a column contains numbers and texts, some data cannot be read. Sometimes, text data cannot be read, and sometimes numeric data cannot be read. Why? In the past, oledb intelligently determined the column type of Excel Based on the data of the first eight rows. When the number of rows of text data> the number of rows of numeric data, the column type is set to text, otherwise it is a number. So what should I do if I want to read all the data? The secret is thatIMEX = 1To read data in import mode.

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.