Forum > Databases

Problems connecting from Lazarus 0.9application to MySQL 5.0

(1/1)

abench:
I am trying connect from Lazarus 0.9.20 application to MySQL 5.0 Database using follow visual components


--- Code: ---
    DBGrid1: TDBGrid;
    Debug: TMemo;
    QBaseNavigator: TDBNavigator;
    QBaseDatasource: TDatasource;
    QBaseConnection: TMySQL50Connection;
    QBaseTransaction: TSQLTransaction;
    QBaseSelectQuery: TSQLQuery;
    QBaseUpdateQuery: TSQLQuery;


--- End code ---

When I execute next code



--- Code: ---
    QBaseConnection.Open;
    finally
        if  QBaseConnection.Connected
            then Debug.Lines.Append('Sucessfully connected')
            else Debug.Lines.Append('Connection fault');
    end;
    try
       Debug.Lines.Append('Begin sql statement execution');
       QBaseSelectQuery.SQL.Text:=('SELECT * FROM Quest_main');
       QBaseSelectQuery.Active:=true;      
       QBaseSelectQuery.Open;
       Debug.Lines.Append('end of sql statement exection');
    finally
       Debug.Lines.Append('sql statement executed');

       Debug.Lines.Append('fields number'+intToStr(QBaseSelectQuery.FieldCount));
       
    end;

--- End code ---


I successfully connected to database, but after executing SQL statement I received answer with 0 fields and 0 rows.

After executing mentioned SQL statement in Query Browser i receive answer with 4 rows.

What I doing wrong?  

Navigation

[0] Message Index

Go to full version