Page 1 of 1

OldValue and NewValue

Posted: Wed 05 Nov 2008 12:07
by Aventurine
Hello,
using C++ Builder6 and MyDac 5.20.1.14
i have problems with OldValue and NewValue
OnDataChange

Code: Select all

void __fastcall TForm1::MyDataSource1DataChange(TObject *Sender,
      TField *Field)
{
  AnsiString UpdateStat[] = {"Unmodified", "Modified", "Inserted", "Deleted"};
  Label1->Caption = UpdateStat[MyTable1->UpdateStatus()];
     if (MyTable1->UpdateStatus() == usModified)
     {
        Edit1->Text = Field->OldValue;      // i get an error when i put cursor to another field
        Edit2->Text = Field->NewValue;    // Field->Value - error too

// when i remove these two lines and put for example Edit1->Text = "yes" it works. So the problem these two lines

     }
     else
      {
         Edit1->Text = "Unmodified";
         Edit2->Text = "Unmodified";
      }
}
the error is

Code: Select all

 'Access violation at address 00493D73. Read of address 00000034' 
And one else
RestoreUpdates() doesn't do anything

Code: Select all

MyTable1->RestoreUpdates();
Only when i edit current field and don't put cursor to another field this function restore old value.

Code: Select all

MyTable1->RevertRecord();
works but only with current record. i need to restore records since the button with MyTable1->ApplyUpdates() has been pressed

Thanks

Re: OldValue and NewValue

Posted: Wed 05 Nov 2008 15:55
by eduardosic
try the last build of MyDAC.

Posted: Thu 06 Nov 2008 07:48
by Dimon
We have fixed this problem in the latest MyDAC build (5.70.0.41). Please, upgrade to this build to solve the problem.