[fpc-pascal] Connecting to a database from a commandline pascal program
daworm at gmail.com
Fri Feb 16 17:04:17 CET 2018
... be more like...
MyConnection := TZConnection.Create();
MyQuery := TQuery.Create();
Then at the end you'd need...
On Fri, Feb 16, 2018 at 10:25 AM, Terry A. Haimann <terry at haimann.us> wrote:
> I am trying to write a command Line Pascal program to connect to a MySQL
> database using the ZeosDBO Library. I am sure I have done something
> I have it now so that it will compile, but it crashes as soon as I try
> to modify my TZConnection variable.
> I have it defined as:
> MyConnection: TZconnection;
> And code is defined as:
> // MyQuery.Create(Nil);
> MyConnection := '127.0.0.1';
> MyConnection.Protocol := 'mysql';
> MyConnection.Database := 'MyDatabase';
> MyConnection.User := 'MyUser';
> MyConnection.Password := 'MyPass';
> MyConnection.Connected := True;
> It never hits 2.0, so I believe it is dying on the create. Am I doing
> the create wrong? I can't find any examples as too doing this, I have
> tried googling it. Most of the examples I see are doing this from
> Lazarus. Not from a command line Free Pascal program.
> Thanks in advance, Terry H.
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal