Hi dmalhotr2001,
Whenever I'm in the position in with trasactions are required but not
supported, I use a try construct.
Try all your actions but don't do them for real. If all succeeds do the
actions for real.
For instance uploading to multiple databases lets say a oracle and a sql
database.
Try the actions rollback by default. If all goes well (no errors) run the
actions again without the rollback.
In your case do the upload to a temp location, do the database actions and
rollback.
When both return without errors move the file to the real location and do
the databse actions again.
This is of course not as good as a transaction, but it increases the
likelyhood of a success.
Kind regards,
--
Rainier van Slingerlandt
(Freelance trainer/consultant/developer)
www.slingerlandt.com
"dm**********@yahoo.com" wrote:
Hi,
I have a piece of code that uploads a file and writes to a database.
Is there a way that if the upload of the file fails or the database
write fails, that the entire process can be rolled back, so that
neither was done.
Basically what I'm trying to do is kind of like a transaction in .net
but not exactly because its not all sql. I just want the entire
process to rollback to its original state if either the file upload or
the sql write fails.
Is there a code example online?
Thanks in advance.
:D