Console Program using ADO

I am doing a console program.  It is a CGI program so that I need it to be a console program.

The program need to access a Visual FoxPro database.  As I tried to use ADO as follow:

var ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;

begin
   ADOConnection1 = TADOConnection.Create(nil);
  .
  .
  .


After the create statement, the program generate an exception (EOleSysError / CoInitialize has not been called).  I tried with BDE, everything work fines. Please help with the case.  

Every development in my team use ADO, I wish my new program can use ADO rather than BDE.

Thanks in advanced.
LVL 2
wkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wkAuthor Commented:
Edited text of question.
0
kanpuCommented:
To make a CGI program in delphi dont mean you should only use CGI.
If your internet server is IIS, I think ISAPI can be more easily integrated with FOXPRO.And the way in which you developed is the same as CGI, and you can use many components,which will make you more comfortable.
 
0
rwilson032697Commented:
Call CoInitialise(Nil) as the first statement in your program (preferably in the initialization section of the unit which contians the code you list).

This willremove the error you describe.

Cheers,

Raymond.
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

kretzschmarCommented:
hi raymond,
seemed you will get back the place 1
meikl ;-)
additional: listening . . .
0
rwilson032697Commented:
Oh yes, include ActiveX in your uses clause...

Meikl: Hopefully!

Cheers,

Raymond.
0
LischkeCommented:
Now I know how one can get 200.000+ points. Answering question like this as first one ;-))) ...lucky Ray...

Ciao, Mike
0
wkAuthor Commented:
I tried, I put copy your statement to my program, and Delphi return "unknown identifier".

After searching the help, I found nothing match "CoInitialise".  Please help to indicate how to execute the said statement and what unit I need to include in my program.

Thanks again.
0
LischkeCommented:
It's ActiveX.pas. Alternativly you can also use OLEInitialize (has the same effect and is mentioned in the help file).

Ciao, Mike
0
rwilson032697Commented:
Oops - i misspelt it, Try

CoInitialize(Nil);  (With the 'z' - darn American Spelling!)

Don't forget to add ActiveX to the uses clause.

Cheers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wkAuthor Commented:
It works, thanks once again.  Since I am the fisrt time writing console program with ActiveX, people should not laugth at me for a 1000 points on this question.

0
rwilson032697Commented:
wk: No one is laughing at you... You put an amount of points of the Q that reflected the urgency and difficulty you were having with the problem. It is quite subjective!

Cheers,

Raymond.
0
LischkeCommented:
My speaking Ray :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.