Only one field updated
Posted: Fri 05 Dec 2008 20:09
Using Borland C++ and MySQL Components
For some reason, only one field is updated.
void __fastcall TForm1::BitBtnUpdateClick(TObject *Sender)
{
// MyTable1 is in Edit mode
MyTable1->FieldByName("field1")->AsString = Edit1->Text.Trim(); // line1
MyTable1->FieldByName("field2")->AsString = Edit2->Text.Trim(); // line2
MyTable1->FieldByName("field3")->AsString = Edit3->Text.Trim(); // line3
MyTable1->Post();
}
After posting, only the first field takes the new value. For some reason field2 and field3 do not get updated.
If I comment out line1, field2 would get updated and field3 would not, as if the assignment works only once.
Even step-by-step debugging shows that after line3 is executed the field value remains unchanged.
Any reason why?
Thanks.
For some reason, only one field is updated.
void __fastcall TForm1::BitBtnUpdateClick(TObject *Sender)
{
// MyTable1 is in Edit mode
MyTable1->FieldByName("field1")->AsString = Edit1->Text.Trim(); // line1
MyTable1->FieldByName("field2")->AsString = Edit2->Text.Trim(); // line2
MyTable1->FieldByName("field3")->AsString = Edit3->Text.Trim(); // line3
MyTable1->Post();
}
After posting, only the first field takes the new value. For some reason field2 and field3 do not get updated.
If I comment out line1, field2 would get updated and field3 would not, as if the assignment works only once.
Even step-by-step debugging shows that after line3 is executed the field value remains unchanged.
Any reason why?
Thanks.