Question : Using commit and rollback with ASP

Hello,

I am inserting rows into 4 different tables from an ASP page. If any of the inserts fail, i designate a variable v_transaction_failed="true".

At the end of the page I do a test to see if v_transaction_failed is true and if it is, i want the program to rollback the changes.

However I can't seem to make it work, I've tried using:
set rs=conn.execute("ROLLBACK TRANSACTION")

How do you use theese transactions with ASP? Do I need to specially configure the ODBC DSN? What else do I need to know to make it work?
Please make your answer thorough, as I am new to sybase SQL transactions and I know practically nothing about it.

Thanks on advance,

Morten Kirsbo

Answer : Using commit and rollback with ASP

Here is the example from MicroSoft using BeginTrans, CommitTrans, RollbackTrans

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdaexamples_vb01_10.asp

Well, MS example uses a message box, but you can check the error count if you want to rollback transaction

'Check for errors
If Conn1.errors.count > 0 Then
   Conn1.RollbackTrans
   Response.write "error : " & Conn1.errors.Item(0).Description
   Conn1.close
   set Conn1 = Nothing
End If


HTH

Random Solutions  
 
programming4us programming4us