Home > Back-end >  C builder ACCESS database operation problem, urgent
C builder ACCESS database operation problem, urgent

Time:10-04

I use c + + builder ADO controls to access the database, use ADOQuery1 - & gt; SQL - & gt; Add this function queries the meet the conditions as a result, but how are extracted from the results, I am trying to get the results of the assigned to a TComboBox - & gt; The Items, but I don't know how to operate, great god save, thank you!

CodePudding user response:

Traversing the data set to go, probably code:
 ComboBox - & gt; The Items - & gt; The Clear (); 
.
ADOQuery - & gt; The Open ();
for (int i=0; I & lt; ADOQuery - & gt; RecordCount. I++)
{
ComboBox - & gt; The Items - & gt; Add (ADOQuery - & gt; FieldByName (" field name ") - & gt; AsString) are identical.
ADOQuery - & gt; The Next ();
}
.

CodePudding user response:

Thank you very much, already can,

CodePudding user response:

reference 1st floor ccrun response:
traversal data set to go, probably code:
 ComboBox - & gt; The Items - & gt; The Clear (); 
.
ADOQuery - & gt; The Open ();
for (int i=0; I & lt; ADOQuery - & gt; RecordCount. I++)
{
ComboBox - & gt; The Items - & gt; Add (ADOQuery - & gt; FieldByName (" field name ") - & gt; AsString) are identical.
ADOQuery - & gt; The Next ();
}
.

Demon elder brother, no problem