Can not connect to mysql [solved]

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
deadflowers
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 28.01.2010, 21:36

Can not connect to mysql [solved]

Post by deadflowers »

hi all, iam new bie to use zeos and i have probelm when i am try to connect mysql. my error message database connection component is not assigned. i use delphi 7 and mysql server 5.0.16-nt.

and this my code :

Code: Select all

var 
   Db:TZConnection;
   query:TZQuery;
begin
Db:=TZConnection.Create(nil);
    Db.Protocol:='mysql';
    Db.HostName:='localhost';
    Db.Database:='bali';
    Db.User:='root';
    Db.Password:='';
    query:=TZQuery.Create(nil);
    query.SQL.Clear;
    query.SQL.Add('SELECT * from inbox limit 0,10');
    query.Open;
    query.Last;
    writeln(query.FieldByName('Text').AsString);
    query.Close;
    Db.Free;
end;
Last edited by deadflowers on 28.01.2010, 22:05, edited 1 time in total.
jeckson
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 28.01.2010, 19:52

Post by jeckson »

try it

Code: Select all

var
Db:TZConnection;
query:TZQuery;
begin
Db:=TZConnection.Create(nil);
Db.Protocol:='mysql';
Db.HostName:='localhost';
Db.Database:='bali';
Db.User:='root';
Db.Password:='';
query:=TZQuery.Create(nil);
query.Connection := DB;
query.SQL.Clear;
query.SQL.Add('SELECT * from inbox limit 0,10');
query.Open;
query.Last;
writeln(query.FieldByName('Text').AsString);
query.Close;
Db.Free;
end;
deadflowers
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 28.01.2010, 21:36

Post by deadflowers »

wow..its work..iam try to add query.Connection := DB;

thxs....
Post Reply