How to get the value of a special row?

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

detective0922
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 01.01.2014, 06:41

How to get the value of a special row?

Postby detective0922 » 01.01.2014, 07:11

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[i]=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
Last edited by detective0922 on 04.01.2014, 19:09, edited 1 time in total.

detective0922
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 01.01.2014, 06:41

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

Postby detective0922 » 04.01.2014, 17:56

I update the question, could anyone help me? :)

miab3
Zeos Test Team
Zeos Test Team
Posts: 916
Joined: 11.05.2012, 12:32
Location: Poland

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

Postby miab3 » 04.01.2014, 22:00

@detective0922

Maybe so?:

Code: Select all

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

Michal

detective0922
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 01.01.2014, 06:41

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

Postby detective0922 » 05.01.2014, 19:31

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.


Return to “6.6 - stable”

Who is online

Users browsing this forum: No registered users and 1 guest