i have a problem to make database connector with ADO.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
TADODataSet *tmp = new TADODataSet(this);
tmp->Connection = altiCon;
tmp->CommandText = "SELECT COUNT(*) FROM Manager_Config";
tmp->Open();
tmp->Fields->Clear();
tmp->Close();
tmp->CommandText = "SELECT * FROM Manager_Config";
tmp->Open();
while (!tmp->Eof) {
int a = tmp->FieldByName("version")->AsInteger;
tmp->Next();
}
tmp->Close();
delete tmp;
|
this is my code.
the problem is it does not update fields information.
for example. first query (SELECT COUNT(*) FROM Manager_Config) makes fields.
so, i can get the values with tmp->FieldByName("---")
in second query (SELECT * FROM Manager_Config) does not make fields.
so, i can't get the values with tmp->fieldByNames("---").
i can get the values only with tmp->fields->fields[0].
how can i refresh fields information after each opening TADODataSet?
thanks.