Error Canceling post in OnBeforePost event
Posted: Fri 08 Jul 2005 10:18
Hi,
I am testing Trial version of your VCL components. When I call Insert method or just start editing row and then move to other row and than cancel the insert or update operation it will always insert new row! Am I doing something wrong?
thanks
I am testing Trial version of your VCL components. When I call Insert method or just start editing row and then move to other row and than cancel the insert or update operation it will always insert new row! Am I doing something wrong?
thanks
Code: Select all
void __fastcall TForm1::Button1Click(TObject *Sender)
{
MyTable1->Insert();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
MyTable1->Post();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
MyTable1->Delete();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MyTable1BeforePost(TDataSet *DataSet)
{
if ( !DataSet )
return ;
if ( !( DataSet->State == dsEdit || DataSet->State == dsInsert ) )
return ;
AnsiString strMessage = "";
switch ( DataSet->State )
{
case dsEdit:
strMessage = "Editujete data, uložit zmìny?";
break;
case dsInsert:
strMessage = "Vkládáte data, uložit zmìny?";
break;
} // end switch
if ( MessageDlg(strMessage, mtConfirmation, TMsgDlgButtons() Cancel();
}
//---------------------------------------------------------------------------