RE: Rollback transaction



One way of maintaining the transation that I would suggest is to create
disconnected ado recordsets and store each form data into them. You don't
need a connection for this.

Write a common routine that will create a single connection object. Inside a
Begin and End transaction block, read each recordset and update the database.

Call this routine when the input to all the forms are completed. This logic
will work even if the user leaves the form open and comes back to input the
rest of the data at a later stage.

But if the user closes the application with partially entered data, this
won't workout. You will have to persist the recordset data by saving it to an
xml file.

"steven scaife" wrote:

> I am unsure how to do this but what i need to do is this:
>
> My users have 12 forms to collect all the financial info of a client,
> personal details insurance policies and other stuff. At the moment when all
> 12 forms are completed the user hits a button and my stored procedures run
> saving the info to the database.
>
> I have been asked to make the program autosave to the database after each
> form is completed, however if they close down the program before the forms
> are completed I need to rollback the changes.
>
> I know if I had a connection open across all the forms i could call
> rollbacktran of the connection object. However I have always been taught to
> close the database connection as soon as possible, and in the environment I
> am people will leave the forms open over night or during dinner, I dont know
> how much overhead there is from leaving the connection open or whether it is
> good practice to do so, I assume its not.
>
> Am I right in thinking that I cant roll back through the connection object
> if I am opening and closing on each page
>
> Could I do this at the start page
>
> conn.execute("begin transaction")
>
> and on the last page when its complete have conn.execute("commit transaction")
>
> This would then mean that the changes are not saved if they exit before the
> commit is sent. Am I correct in thinking this or am I way off the mark, or
> even is there a better way of going about it
>
> if you need more information dont hesitate to ask
>
> TIA
>
> Steven Scaife
.