Recent

Author Topic: Problems connecting from Lazarus 0.9application to MySQL 5.0  (Read 4319 times)

abench

  • Newbie
  • Posts: 2
Problems connecting from Lazarus 0.9application to MySQL 5.0
« on: March 26, 2007, 04:42:23 pm »
I am trying connect from Lazarus 0.9.20 application to MySQL 5.0 Database using follow visual components

Code: [Select]

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


When I execute next code


Code: [Select]

    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;


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?