?
Solved

adotable.beforepost

Posted on 2003-03-11
4
Medium Priority
?
447 Views
Last Modified: 2010-04-04
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
Comment
Question by:shirin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:sfock
ID: 8114616
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
 

Author Comment

by:shirin
ID: 8117119
hi,
I try it but has a error (at  e:abort) as below:
‘abort is not a type identifier’
0
 
LVL 3

Accepted Solution

by:
sfock earned 200 total points
ID: 8117332
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
 

Author Comment

by:shirin
ID: 8121470
thanks and have a good time.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question