Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to make sure that my transaction as well as copying of a perticular file happen both simoultanously..or they dont happen


how can i achieve this...
Posted
Comments
krumia 8-Jun-12 7:20am    
SQL transaction? Fily copy? where does this happen? Which SQL server? Is file copying done by the SQL server, or is it a separate process?
Sandeep Mewara 8-Jun-12 7:48am    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.

1 solution

You'll need microsoft transaction server (mts) for this. With it, you create a transaction context, execute multiple actions (like file handling and database updates, also mixed) that all need to call SetComplete (indicating the code didn't encounter any problems). When you then call Commit, MTS will try to commit all the actions. If one of the actions called SetAbort or the Commit somehow fails, a full rollback will ensure nothing changed.

Check out this link for more info:
http://technet.microsoft.com/en-us/library/cc805563[^]

Good luck!
 
Share this answer
 
Comments
gaurish thakkar 8-Jun-12 9:13am    
thanks ..and the copying is not done by sql
E.F. Nijboer 8-Jun-12 17:01pm    
My idea was also that the copying of the files wouldn't be done using sql. The nice thing is that file operations are also permitted in the transaction context together with the database operations. mts will then ensure both to be in a transaction.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900