Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

adotable.beforepost

Hi experts,
I add a beforepost to my adotable for last confirming as below:


procedure TForm1.ADOTable1BeforePost(DataSet: TDataSet);
begin
if messagedlg('do you accepet these data ?',mtconfirmation,[mbyes,mbno,mbcancel],0)<>mryes then
abort;
end;

I have a two question:
     1-The adotable state remain on inserting mode( the last mode)  but I want to go to dsbrowse mode after aborting
         how can do this work(I know that with close and open again, the table go  to dsbrowse but not good in my mind)?
2-the dbgrid  show the last data in the unvalid record( for aborting in beforepost) how can delete these data ?

do you have any solution that  changing my way in giving messagedlg or etc?


thanks a lot.
shirin

0
shirin
Asked:
shirin
  • 2
  • 2
1 Solution
 
sfockCommented:
try

procedure TForm1.ADOTable1BeforePost(DataSet: TDataSet);
begin
  try
    if messagedlg('do you accepet these data ?',mtconfirmation,[mbyes,mbno,mbcancel],0)<>mryes then
      abort;
  except
    on e:Abort do
      ADOTable1.cancel;
  end;
end;
0
 
shirinAuthor Commented:
hi,
I try it but has a error (at  e:abort) as below:
‘abort is not a type identifier’
0
 
sfockCommented:
oh i am sorry, typed it just in the browser and i forgot another thing, vhange it to

 except
   on e:EAbort do begin
     ADOTable1.cancel;
     raise;
   end;
 end;
0
 
shirinAuthor Commented:
thanks and have a good time.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now