onebadboy
asked on
CoInitialize has not been called
Whenever I try to do any database work inside of a thread I get this error "CoInitialize has not been called"
It doesn't matter what I do, Insert, Delete, Select
But the same code works fine if it's used in a form any ideas?
It doesn't matter what I do, Insert, Delete, Select
But the same code works fine if it's used in a form any ideas?
ASKER
The other error I get is Could not obtain OLE control window handle.
ASKER
The other error I get is Could not obtain OLE control window handle.
Hmmmm... Am no expert here, but why don't you call CoInitialize from within the thread?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
initialization
CoInitializeEx(nil,COINIT_
finalization
CoUninitialize;
and I've tried
and initialization
CoInitialize(nil);
finalization
CoUninitialize;
I've also tried putting this code in a unit by itself and making it the first statment in my Uses Clause
unit ComInit;
interface
uses
ActiveX;
implementation
initialization
CoInitializeEx(nil,COINIT_
finalization
CoUninitialize;
end.
All to no avail. Although I do get a different error message when I try it the last way.
Any ideas