Hi Guys
Im trying to get my application to connect to my MDB database but it keep throwing me an error
###########################################################
"CoInitialize has not been called"
With the ComObj.Pas opened @ location :
procedure OleError(ErrorCode: HResult);
begin
raise EOleSysError.Create('', ErrorCode, 0); <- program stops here, this isnt even mine...
end;
###########################################################
Ive been working with MDB for awhile now and this is the first time ive seen this error ?
###########################################################
My uses on that form:
uses
Windows, Messages, SysUtils, Classes, variants, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, CoolTrayIcon, Menus, Mask, registry, dxfColorButton,
DB, ADODB;
My uses on form2
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, dxfColorButton, ExtCtrls, winsock, ScktComp;
My uses on form3
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, registry, Mask, shellapi, DB, ADODB;
###########################################################
My connection procedure:
procedure TForm1.dbCon(Sender: TObject);
begin
if fileexists(read3+'\data\stcdb.stc') then
begin
adotable1.Active := false;
adoconnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+
'User ID=Admin;'+
'Data Source='+read3+'\data\stcdb.stc'+';'+
'Mode=Share Deny None;Extended Properties="";'+
'Persist Security Info=False;'+
'Jet OLEDB:System database="";'+
'Jet OLEDB:Registry Path="";'+
'Jet OLEDB:Database Password="";'+
'Jet OLEDB:Engine Type=5;'+
'Jet OLEDB:Database Locking Mode=1;'+
'Jet OLEDB:Global Partial Bulk Ops=2;'+
'Jet OLEDB:Global Bulk Transactions=1;'+
'Jet OLEDB:New Database Password="";'+
'Jet OLEDB:Create System Database=False;'+
'Jet OLEDB:Encrypt Database=False;'+
'Jet OLEDB:Don''t Copy Locale on Compact=False;'+
'Jet OLEDB:Compact Without Replica Repair=False;'+
'Jet OLEDB:SFP=False';
adotable1.Active := true;
if adotable1.Active = true then memo2.Lines.Add('Connected to Server-D-Base') else memo2.Lines.Add('Failed Server-D-Base');
end else showmessage('Error connecting to the database...'+#13#10+'The file stcdb.stc was not found at "..\data\"');
end;
Plz help out, needed solution quickly...
by: JDSkinnerPosted on 2006-08-13 at 03:57:36ID: 17304943
Hi Gavin to Server-D-Base') else memo2.Lines.Add('Failed Server-D-Base');
Your connection procedure,
....
if adotable1.Active = true then
memo2.Lines.Add('Connected
end // ??????? Try removing this line
else showmessage('Error connecting to the database...'+#13#10+'The file stcdb.stc was not found at "..\data\"');
...