Troubleshoot importing Excel in Windows Server2008r2 cannot use Jet 4.0

Source: Internet
Author: User

The operating system uses Windows SERVER2008R2 (Windows SERVER2008R2 is a 64-bit system and is configured IIS7.0

The original read Excel file code is:

string string. Format ("provider=microsoft.jet.oledb.4.0;data source= ' {0} '; Extended properties= ' Excel 8.0; Hdr=yes;imex=1 '"new OleDbDataAdapter (" select * from [""  New  DataSet (); Excelda.fill (Dstexcel, "Excelinfo");

On Windows Server2003 Everything is fine, the 64-bit server is not normal, looking for data that can be the application pool to set the Enable bit option to true, but IIS stability and compatibility is not good.

But the actual operation of the application pool 32 bit is true also not.

Workaround One:

Re-check the data using Microsoft.ACE.OLEDB to manipulate Excel. The modified script is as follows:

string string. Format ("provider=microsoft.ace.oledb.12.0;data source={0}; Extended properties= ' Excel 12.0; Hdr=yes '"new12.0; Hdr=yes ' The single quotation mark must not be less.

After the test, it was found that the Enable + bit option of the application pool was set to True plus this link was used normally.

Workaround Two:

Install a "accessdatabaseengine_x64" driver, you do not have to modify the program pool options, and then use the "Microsoft.ACE.OLEDB" link string.

In my program I judged the number of bits in the operating system to automatically switch the corresponding link string.

Environment.is64bitoperatingsystem

Troubleshoot importing Excel in Windows Server2008r2 cannot use Jet 4.0

Related Article

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.