473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

When to do an ADO rollback

While scouting around this group, I've stumbled upon this ASP script
which deals with rolling back transactions -

'-- Error Handler
if oConn.Errors.Count > 0 then
oConn.RollbackTrans
Response.Write("FAIL")
Response.End
Response.write(err.description)
end if
Which has given me pause to wonder if what I am doing is correct. I'm
basing my rollback on the err.number not being 0 (sample code below).
Is this ok, or should I be using the conn.errors.count property
instead?

TIA,

Colin
If Not UpdateDealerPeopleInfoPending Then
conn.RollbackTrans
response.redirect("msg_employment_status_update.as p?error=2")
End If

Function UpdateDealerActionsSummited()

On Error Resume Next

sql = "random sql update statement"
conn.execute sql, , &H00000080
Set sql = Nothing

'Errors?
If err.number <> 0 Then
UpdateDealerActionsSummited = False
Else
UpdateDealerActionsSummited = True
End If

End Function
Jul 19 '05 #1
1 3659
> Response.End
Response.write(err.description)
This response.write will never happen.
Which has given me pause to wonder if what I am doing is correct. I'm
basing my rollback on the err.number not being 0 (sample code below).
Is this ok, or should I be using the conn.errors.count property
instead?


Well, the err.number could be <> 0 for simple warnings that can't be
suppressed (e.g. if your procedure does an sp_rename). So in some cases,
this isn't enough...

However, if you are using SQL Server, it would be much more reliable to
handle your error errors and transactions within a stored procedure.

http://www.algonet.se/~sommar/error-handling-I.html
http://www.algonet.se/~sommar/error-handling-II.html
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: tkestell | last post by:
Is their anyway to perform mass deletes (several million records) without "maxing out" rollback segments? I'm working on archiving data from an Oracle 8.1.7 database The system is about 4 years...
2
by: Alice | last post by:
Hi all, Given a rollback segment with storage as follows : Initial Extent 5 MB Next Extent 5 MB Min Extents 20 Does this mean that every time a transaction uses this rollback segment it...
2
by: Alice | last post by:
Hi all, I have a problem with rollback segment. I am a beginner and do not have much knowledge of DBA. Anyways, the problem is there is a transaction of around 105 MB. This would not fit...
3
by: level8 | last post by:
Hi, Everybody, I'm a Hungarian SQL user and I need a little help for SQL Server 7 ! I protect my table against bad data with a trigger. I use ROLLBACK and RAISERROR statement in this trigger....
0
by: Rick Razzano | last post by:
I am seeing some strange behavior in sql server. Running a procedure with a table variable, selecting from the table, and exiting the loop will cause a rollback statement to be issued (which you...
2
by: mahajan.sanjeev | last post by:
Hi, I am having problems with rollback using the SQLTransaction object. I am trying to insert records in two tables in a transaction. I want to rollback all the changes if any exception occurs...
1
by: alan | last post by:
I've use VB.NET+Access to write build a simple POS application. For example i got two computer, comp A and comp B. Which comp A share a Access db file through the network. When open a new bill, the...
4
by: graphicsxp | last post by:
Hello, I've got a few stored procedure called made within one sqlTransaction object. If the .Rollback() method of the transaction is called, then I would like some extra code to be executed....
1
by: cheesey_toastie | last post by:
I have a long query which I have set off and would like to stop, and rename one of the tables used. My query is due to my lack of understanding of the underlying structure of MSSQL-Server... ...
1
by: varmamkm | last post by:
I am new to db2 and want to know more about rollback and exception handling.... I am using AS/400 operations navigator to write the stored procedures. I am trying this by using SAVEPOING and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.