Jump to content
Sign in to follow this  
Merrik

SQL COM Error - CoInitialize

Recommended Posts

Merrik

I'm getting the COM error below when attempting to SQL Insert from a script that uses the SERVICES UDF.

I could really use some help with this one.

AutoIt COM error check. We intercepted a COM Error !

err.description is:

err.windescription: CoInitialize has not been called.

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: -1

err.source is: ADODB.Connection

err.helpfile is:

err.helpcontext is: 1240640

AutoIt COM error check. We intercepted a COM Error !

err.description is:

err.windescription: CoInitialize has not been called.

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: -1

err.source is: ADODB.Connection

err.helpfile is:

err.helpcontext is: 1240640

Share this post


Link to post
Share on other sites
arcker

can you try this before calling objects ?

$COINIT_APARTMENTTHREADED = 0x02
DllCall('ole32.dll', 'long', 'CoInitializeEx', 'ptr', 0, 'dword', $COINIT_APARTMENTTHREADED)
Edited by arcker
  • Like 1

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites
malcolmsearle

can you try this before calling objects ?

$COINIT_APARTMENTTHREADED = 0x02
DllCall('ole32.dll', 'long', 'CoInitializeEx', 'ptr', 0, 'dword', $COINIT_APARTMENTTHREADED)

arcker - just found this post after a bit of Googling. Wanted to say thanks.

I was getting error -2147221008 when running DllCall("C:WINDOWSSome.DLL", "long", "DllRegisterServer"). I wanted to register 15 DLLs in an AutoIt script, but could only register 14 of them.

My searches showed that this error is related to CoInitialize not being called.

I added the line you specified, i.e.

DllCall('ole32.dll', 'long', 'CoInitializeEx', 'ptr', 0, 'dword', $COINIT_APARTMENTTHREADED)

before my call to DllRegisterServer and the error went away.

Thank you!!!

Edited by malcolmsearle

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  

×