?
Solved

some problem was occured in closing dataset

Posted on 2003-03-16
7
Medium Priority
?
156 Views
Last Modified: 2010-04-04
hi experts,

I do some work in afterinsert event of  a table( my work is copying a file to a special location) .
But if user close the dataset(closing the data entry form without any change) this file(copyied file)is unused.
How can prevent of this work(with informing of unchanging in dataset)?

thanks in advance
m.reza

0
Comment
Question by:Imbeginner
[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
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8150259
move your afterinsert-event-code into
the beforepost-event like

...
  If Dateset.State = dsInsert then
  begin
    //here code what has been in the afterinsert-event
  end;
...

meikl ;-)
0
 

Author Comment

by:Imbeginner
ID: 8154522
One problem
When a problem in data entry was occurred the last problem remained.
The data was send to database and database realize that example primary key has null value or dublicated value .
In this case the file was copied but unuseful.
How can solve this problem ?

thanks
0
 

Author Comment

by:Imbeginner
ID: 8158132
any feed back from you kretzschmar?
i increased my points to 50.

thank
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 8158158
sorry for delay, points doesn't matter

hmm,
thats bad,
in this case a movement of your code isn't
the solution.

another try would be to supply the onCancel-event,
for deletion the just copied file

would this work for you?

meikl ;-)
0
 

Author Comment

by:Imbeginner
ID: 8159549
I have two questions:

1-I want to know you earn money for your high experts points.

2-I don’t understand what is the oncancel –event.
I see aftercancel for adotable1 but ….
I say my idea for this problem with help of your first comment :

In my mind I can add this deletion  ON  E: EDATABASEERROR , for it I should define tempfile1(location of file) as global  variable.
But I don’t know  where I should use this event(try .. except)?
   
If this is not good way or you have a better solution please describe it  for me(please clarify what I should do)?

Thanks a lot.
m.reza
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 8159693
>1-I want to know you earn money for your high experts points.

no, i get no money and no naturals :-))

>2-I dont understand what is the oncancel event

sorry, my mistake,
i meant the beforecancel-event -> sorry

>In my mind I can add this deletion  ON  E: EDATABASEERROR

there is better place -> onposterror

but i would prefer the beforecancel event,
because after an error the dataset will stay
in editmode until you cancel it or you get it
properly posted

but this depends on your app and
on the possibilities if and how a
user can handle these errors within
your app byself.

if the user never can handle db-errors, then
use the onposterror-event for deletion.

meikl ;-)
0
 

Author Comment

by:Imbeginner
ID: 8162546
for high trust i select onposterror.

thanks for everythning.
in my idea, the real expert  who  can transfer his(or her)engineer ideas to others(not only solve a problem).
you are really a expert.

i wish you will be successful in every stage of your life.

thanks again and have a good time.

m.reza




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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

762 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