Results: Was this a Dumb Post 

Voters
0 You may not vote on this poll

  • Yes Jon's an Idoit
    0%
  • Yes, But Jon just need to go back to skewl
    0%
  • No but it is way to easy to fix
    0%
  • No I've Been Wondering the same thing
    0%
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    Ark.
    Posts
    1
    Rep Power
    0

    Transactions AND ASP (Not .NET)


    I have three tables I am preforming UPDATES On I need to use transactions because if a write fails for some reason on table three the previous two writes need to be rolled back Right now my code is like the following.
    Code:
    <%
    On Error Resume Next
    set jc =server.CreateObject("ADODB.CONNECTION")
    jc.Open Application("My_ConnectionString")
    SQL = "Select * from OwnerTable where OwnerAcctNum = '" & Session("OwnerAcctNum") & "'"
    rc.CursorType = adOpenStatic
    rc.LockType = adLockOptimistic
    jc.BeginTrans
    rc.Open SQL, jc
    if rc.Fields("BusinessName") <> Request.Form("BBBusName") then
    changedFieldCount = changedFieldCount + 1
    rc.Fields("BusinessName") = Request.Form("BBBusName")
    end if
    {....}
    The above if routine happens for each field we end up with a field changed count of 3 which is correct then finally the update method is called
    {.....}
    rc.update
    %>
    Then the ERROR Code
    Code:
    {....}
    If Err.Number <> 0 Then
    Response.Write " Err.Description: " & Err.description & "<br>" &_
    "Err.HelpContext: " & Err.HelpContext & "<br>" & _
    " Err.Number: " & Err.Number & "<br>" & _
    " Err.Source: " & Err.Source & "<br>"
    printErrorMessage(Err.Number)    
    jc.RollbackTrans
    End If
    {....}
    Then I update the next table. How can i preforme the above and use Transactions?
    Thanks
    Jon {The Intern Fro Hell}
    Last edited by pabloj; January 7th, 2004 at 03:36 PM.

IMN logo majestic logo threadwatch logo seochat tools logo