Balagangadharan.R


hello All

im am developing a windows application using VS2005.

i have a form, in that i have 5 sql quries to save.

suppose the any of the quries got error it should rollback all the quries and should not insert anything in DB.


please help me in this aspect

Thanks in advance





Re: transaction

ghozan


if you're using a connection, for example myConn, try this:

on error goto err_sub
mycon.begintrans
'execute your queries here'
mycon.commitrans

err_sub:
mycon.rollbacktrans

it should do the roll back function if any of you're query is not succeeded. hope that helps.






Re: transaction

Balagangadharan.R

sHOULD I USE LIKE THIS

mycon.begintrans

insert query1

on error goto err_sub

trans.Commit()

insert query2

on error goto err_sub

trans.Commit()

insert query3

on error goto err_sub

trans.Commit()

insert query4

on error goto err_sub

trans.Commit()

insert query5

on error goto err_sub

trans.Commit()

err_sub:

trans.Rollback()







Re: transaction

ghozan

Try this, don't use my previous post. I was confused with the application. It can't be use inside SQL.