Page 1 of 1

How to get the value of a special row?

Posted: 01.01.2014, 07:11
by detective0922
Hello,

I am a new guy with Zeos and I am using C++ builder 6.0+zeoslib 6.6+MySQL 5.0. What I want to do is get the value of the returned rows and then copy the value to a array, my code is list below:

FMain->ZQuery1->SQL->Clear();
FMain->ZQuery1->SQL->Add("select slot from boardinfo where neid=:id");
FMain->ZQuery1->ParamByName("id")->AsInteger=1;
FMain->ZQuery1->Open();
int j=FMain->ZQuery1->RecordCount;
FMain->ZQuery1->DbcResultSet->First();
for(int i=0;i<j;i++)
{
PNode->BoardInfo.v=FMain->ZQuery1->DbcResultSet->GetIntByName("slot");
FMain->ZQuery1->DbcResultSet->Next();
}

There is only one column "slot" returned and the RecordCount is 32, that is correct and I can get the values one by one.
But,if I want to get the value of a special row, for example, get the value of the fifth row in the returned column "slot", how could I do?

Thank you in advance and Happy New Year! :D

Re: How to get the value of a special row?

Posted: 04.01.2014, 17:56
by detective0922
I update the question, could anyone help me? :)

Re: How to get the value of a special row?

Posted: 04.01.2014, 22:00
by miab3
@detective0922

Maybe so?:

Code: Select all

ZQuery1->First();
ZQuery1->MoveBy(4);
Edit1->Text = ZQuery1->FieldByName("slot")->AsString;
Michal

Re: How to get the value of a special row?

Posted: 05.01.2014, 19:31
by detective0922
miab3 wrote:@detective0922

Maybe so?:

Code: Select all

ZQuery1->First();
ZQuery1->MoveBy(4);
Edit1->Text = ZQuery1->FieldByName("slot")->AsString;
Michal
Hi, miab3, thank you very much, it is a useful solution.