How can I get results from query?
everything is OK with insert or remove, but when I want to get records from database I don't know how
TStrings *String;
MyQuery1->SQL->Add("select rating from ratings;");
MyQuery1->Execute();
AnsiString str = MyQuery1->GetDetailLinkFields(String,"rating","ratings");
or something i do wrong, I want to get results from database when i use select
How can I get results from query?
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Re: How can I get results from query?
MyQuery1->SQL->Add("select rating from ratings;");simveck wrote:How can I get results from query?
everything is OK with insert or remove, but when I want to get records from database I don't know how
TStrings *String;
MyQuery1->SQL->Add("select rating from ratings;");
MyQuery1->Execute();
AnsiString str = MyQuery1->GetDetailLinkFields(String,"rating","ratings");
or something i do wrong, I want to get results from database when i use select
MyQuery1->Execute();
Str = MyQuery1->FieldByName( 'FieldName' ).AsString;
This question concerns common issues of using TDataSet. You can read more about this in the Delphi help.
In your case you can use something like this:
Use TDataSet->Next to scroll to the next record in the recordset.
In your case you can use something like this:
Code: Select all
AnsiString str = MyQuery1->FieldByName("rating")->AsString;