This error occurs when you use com or call the ADO control. It is usually a program problem. After COM is called, The OLE function library must be called before coinitialize, because in the application, Delphi will automatically add a call to the CO... function in the initialize unit, and you must call it in the DLL.
However, the following code in the pubdbconn in Delphi prompts that "coinitialize has not been called"
Procedure createadocsql;
Begin
Adocsql: = tadoconnection. Create (NiL );
Try
If adocsql. connected then
Adocsql. close;
Adocsql. connectionstring: = stris;
Adocsql. loginprompt: = false;
Adocsql. Connected: = true;
Adocsql. commandtimeout := 600;
Except
On E: eoleexception do
Application. MessageBox (pchar (E. source), pchar (E. Message), mb_ OK + mb_iconstop );
End;
End;
Initialization
Createadocsql;
End.
Finally, coinitialize (NiL) and couninitilize () are added before and after createadocsql, that is
Try
Coinitialize (NiL );
Createadocsql;
Finally
.....
Couninitialize;
End;
Of course, uses ActiveX is required in the unit.
From: http://blog.csdn.net/trassion/article/details/9712389
Delphi "coinitialize not called" SOLUTION