I'm having trouble updating a recordset using the TMyQuery object. FetchAll is True and CachedUpdate is True. My code looks like this:
MyQuery->SQL->Text= SQLstr;
MyQuery->Execute();
int rowCount= MyQuery->RecordCount;
double v = 0.0;
for(int i=0; iEdit();
v=offsetVec.at(i);
MyQuery->FieldByName("Offset")->AsFloat = v;
MyQuery->Post();
//MyQuery->ApplyUpdates();
MyQuery->Next();
}
}
//MyQuery->ApplyUpdates();
MyQuery->SQL->Clear(); Clear causes a failure.
MyQuery->Close();
offsetVex.size() does equal rowCount. This fails with a "Update failed" error on the ->Close statement. If I replace the ->AsFloat = v; with AsFloat = 99.9; then the update occurs. However, I think that this is an artifact, since if I update just the first record (replace rowCount in the loop statement by 1) all of the records are updated, although I do get an Upate Failed error on the close statement. If I do an ApplyUpdates within the loop after the Post, I also get an Update Failed Error on the ->Next statement.
How can I update the individual records of the recordset?
Thanks
Updating records using TMyQuery in Borland C++
-
Challenger
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53
Updating records using TMyQuery in Borland C++
Sorry, I don't understand. Are you asking for an update statement beyond the MyQuery->ApplyUpdates()? Or are you suggesting that I need to include an Update statement of some sort (maybe an SQL statement?)in addition to what I showed. I've showed everything that is related. If I'm missing some overall design issue I'd sure appreciate a pointer on where to find this in the documentation.
Thanks
Thanks
-
Challenger
- Devart Team
- Posts: 925
- Joined: Thu 17 Nov 2005 10:53