How to get the result from a SELECT * FROM query in TMyQuery

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Rocojo
Posts: 18
Joined: Tue 24 Jan 2006 12:57
Location: Eindhoven, The Netherlands

How to get the result from a SELECT * FROM query in TMyQuery

Post by Rocojo » Tue 24 Jan 2006 13:07

Hello,

I am building a DLL (in Borland C++ Builder 6) witch is going to act as a layer between my software and a MySQL server.

I have two components: MyConnection and MyQuery.

this is what i am doing ( in short version):
MyQuery->SQL->Text = "SELECT * FROM "+ cmbTables->Text;
MyQuery->Execute();

the query is running and working because the MyQuery->RecordCount represents the exact number of rows.... but where can i get the returned values....

Rocojo
Posts: 18
Joined: Tue 24 Jan 2006 12:57
Location: Eindhoven, The Netherlands

Post by Rocojo » Tue 24 Jan 2006 15:32

ok i found by help of the topic obove..... thank you

MyQuery->FieldValues[FieldName]

after executing the query by MyQuery->Execute();

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 24 Jan 2006 15:56

To get returned values you can use Fields property. For example:

Label1->Caption = MyQuery1->Fields->Fields[2]->AsString;

For more information see description of TDataSet.Fields in C++Builder Help.

Rocojo
Posts: 18
Joined: Tue 24 Jan 2006 12:57
Location: Eindhoven, The Netherlands

Post by Rocojo » Tue 24 Jan 2006 22:04

hmm thank you. I will try

Post Reply