PDA

View Full Version : MySQL with C++


Tsholofelo
May 10, 2007, 04:15 AM
I want a query that can select all names in a table and write it in sequential form in a listbox of a form in C++.the connection is well established and communication between my system and my datbase is working fine.

here is the statement I used:

requestName = SELECT SystemName FROM System;
my_query->SQL->Add(requestName);
my_query->Open();
systemRequested = Form1->Bugs_Query->FieldByName("SystemName")->AsString;
listbox1->Items->Add(systemRequested );

it is working fine except that it only gives the first systemName, but I need the whole list. I realised that mysql counts rows from 0 to last-1. I tried for loop but it gives errors:

for(int x=0;x!=-1;x++)
{
requestName = SELECT SystemName FROM System;
my_query->SQL->Add(requestName);
my_query->Open();
systemRequested = Form1->Bugs_Query->FieldByName("SystemName")->AsString;
listbox1->Items->Add(systemRequested );
}

I tried putting vlue of x everywhere it is possible but none seem to work, does anybody know how I can do this.

please help it is very urgent.

thanks (tsholo)