Jump to content
Sign in to follow this  
libin

Error while connecting to OLEDB

Recommended Posts

libin

Good Day!

     I was trying to connect to excel OLEDB with the below code snippet and when i execute the script i get an error "provider cannot be found.It may not be properly installed".However when i connect to excel DB with the same connection string using vb script,it works without any issue.

My Autoit code -

   Local $str12ConnectionString,$objDBConnect,$objRecordSet
   Local $strsqlquery,$objpropdict,$strLoggermessage

   ; Initialize COM error handler
   $oMyError = ObjEvent("AutoIt.Error","fn_get_err_data")

   Local $strorfilepath="C:UsersR609DesktopAutoITRootTestDataObjectIdentifier.xlsx"

   Local $str12Provider = "Microsoft.ace.OLEDB.12.0" 

   $str12ConnectionString = "Data Source=" & $strorfilepath & ";Extended Properties=Excel 12.0;"

   $objDBConnect = ObjCreate("ADODB.Connection")
   $objDBConnect.Open ("Provider=" & $str12Provider & ";" & _
                "Data Source="& $strorfilepath &";" & _
                "Extended Properties=Excel 12.0")

My vb script code -

   strorfilepath = "C:UsersR609DesktopAutoITRootTestDataObjectIdentifier.xlsx"

   str12Provider = "Microsoft.ace.OLEDB.12.0"

   Set objDBConnect = CreateObject("ADODB.Connection")

   objDBConnect.Open ("Provider=" & str12Provider & ";" & _
                "Data Source=" & strorfilepath & ";" & _
                "Extended Properties=Excel 12.0")

   Can some one help me to resolve the issue?

  

Thanks in advance

Libin S

Edited by libin

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Maybe the wiki tutorial (including examples how to access Excel) will solve your problem.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.