05 October 2012

The 'Microsoft.JET.OLEDB.4.0' provider is not registered on the local machine.

     
       หลังจากที่ผมหันไปเขียน Delphi ผมก็แทบจะไม่ได้จับ .Net อีกเลย จนกระทั้งผมมีปัญหากับโปรแกรมนำเข้าไฟล์เงินเดือน ที่พัฒนาด้วย Visual Studio 2008 (3 ปีที่แล้ว) ดันมากบฏเพราะไม่สามารถ นำเข้า File Excel 2003 ที่รันบน Windows 7 64 bit ได้ มันจะขึ้น Error ว่า The 'Microsoft.JET.OLEDB.4.0' provider is not registered on the local machine. ทั้งที่ Run บน Windows 7 32 bit ก็ไม่เป็นไร     


      Search หาแล้วหาอีกก็ไม่เจอ มีคนบอกให้ผมไปแก้ ให้เป็น x86 ไม่ก็เปลี่ยนเป็น Any CPU แต่มันก็ไม่ Work อืม ในขณะที่กำลังจะถอดใจก็ไปเอะใจเรื่อง Connection String ของ Excel จากเว็บไซต์ Code Project 

      ในเมื่อ 64 bit ไม่รองรับ OleDB4.0 ก็เลยลอง Microsoft.ACE.OLEDB.12.0 กับไฟล์ Excel 2003 
     พอเปลี่ยนเป็นแบบนี้ก็หายครับ

    ป.ล. ACE ย่อมาจาก Microsoft Access Database Engine ครับซึ่งถ้าคุณใช้ Office 32 bit (แม้จะเป็น Windows 7 64 bit ก็ต้อง) ลง AccessDatabaseEngine.exe แต่ถ้าเป็น Office 64 bit ก็ต้องใช้ AccessDatabaseEngine x64.exe 




1 comment:

Anonymous said...

Yes, you are right; the demand for eCommerce website development in India is continuously rising as the tech world evolves and businesses become increasingly reliant on technology. You should check out Eiliana.com; they showcase your skills to the right people.