Deadlock errors & vb error trapping

Deadlock errors & vb error trapping

Post by Ron Olso » Tue, 28 Mar 1995 10:12:59



Hi all...

I am using VB & Sybase System 10. Our system is prone to  
deadlocks, which Sybase calls error #1205. I tried to capture  
that in the on error statement where I have a case 1205, mention  
it in the status bar, then retry.

Problem is that I'm using ODBC to Sybase, and I'm thinking that  
perhaps ODBC is converting the 1205 error to something ODBC uses.  
Problem is, I can't tell what that is because it's difficult to  
reproduce a deadlock on demand.  

Might anyone know what error code I should be checking for in  
this situation?

Thanks a lot for any info

Ron

 
 
 

1. Error Trapping: MS Access errors not trapped in VB code

I have an error trap in my VB 5.0 code that doesn't work when an error
is coming from and MS Access db.  These are errors that occur when
there is a primary key violation or a referential integrity violation.
I have done similar error trapping in the past and it worked fine.
The only difference in code is that I was using a data control in the
code that worked and now I'm working directly with the recordsets.  

The following is the code sample.  The error occus on rsPallet.Update:

        On Error GoTo ErrHandler

        rsPallet.AddNew
        rsPallet![StockNum] = txtPaperType.Text
        rsPallet![LoadTicket] = txtLoadNum.Text
        rsPallet![LinYds] = txtTotYards.Text
        rsPallet![DateRec] = txtTruckDate.Text
        rsPallet![RollCount] = txtNumRolls.Text
        rsPallet![UserId] = gUserID

ErrHandler:
    Dim errorNumber
    errorNumber = Err.Number
    Select Case errorNumber
    Case 3022   'primary key violation - load number is not unique for
the truck date given
        message = "Load number " & txtLoadNum.Text & " has been used
on " & txtTruckDate.Text _
                    & ".  Would you like me to assign a unique load
number?"
        answer = MsgBox(message, vbYesNo, "Primary Key Violation")
        If answer = vbNo Then
            txtStockNum.SetFocus
            txtStockNum.SelStart = 0
            txtStockNum.SelLength = Len(txtStockNum.Text)
        Else
            loadNumber = rsLoadNum![UniqueNum]
            txtStockNum.Text = loadNumber
            rsLoadNum![UniqueNum] = (loadNumber + 1)
        End If
    Case 3201   'invalid paper type, number given doesn't exit in
Paper table
        message = "The stock number " & txtStockNum.Text & " does not
exist." & _
                    "  Please enter a valid stock number."
        MsgBox message, vbExclamation, "Invalid Stock Number"
    Case Else
        message = "The following error has occured:  " & Err.Number &
", " & Err.Description

    End Select

Has anyone else encounter this problem or know the solution?

Thanks.

Sharon Stokesbary

2. visual basic and filemaker (HELP)

3. Trapping SQL error in VB before ADO raises run-time error

4. triggers on sys tables?

5. Error Trapping - Can you trap a DTS Package error using SQLDMO running a job

6. How to debug user-defined function in Sql 2K?

7. ado errors not trapped by vb error object???

8. File Express from Expressware Corporation

9. DAO Error Trapping & Most Common Errors

10. trapping for deadlock errors within stored procedure?

11. DTS and error trapping in VB

12. Error trapping with VB

13. ODBC, SQL and trapping error on VB 4.0