ado errors not trapped by vb error object???

ado errors not trapped by vb error object???

Post by Duane Dougla » Fri, 19 Jan 2001 12:12:34



hello,

does anyone know the answer to this question?  i need a specific answer
and/or documentation.

tia

 
 
 

ado errors not trapped by vb error object???

Post by John Goodfello » Fri, 19 Jan 2001 22:50:45


The ADO object model has its own Errors collection.  Check for errors there.
--
John Goodfellow
irtf'nm
use 'microtouch' in address to email


Quote:> hello,

> does anyone know the answer to this question?  i need a specific answer
> and/or documentation.

> tia


 
 
 

ado errors not trapped by vb error object???

Post by Mike Alvare » Sun, 21 Jan 2001 12:35:10


Duane, I'm having the same problem, but with jet / access...

With Win2000 Advanced Server,VB6 SP4, mdac 2.5, ado data control, Access
2000 mdb.
Sometimes, when I do a Data3.Refresh or Data3.Recordset.Requery, I get this
error in a modal message box:
"The database has been placed in in a state by user 'admin' on machine
'2000server' that prevents it from being opened or locked  <OK>"
The database is probably busy, and I have "on error resume xxx" code to wait
and try again later, but I don't want the user to see this message, however,
I am unable to supress this message no matter what I try.
Does anyone have a idea on how to supress this error message?


Quote:> hello,

> does anyone know the answer to this question?  i need a specific answer
> and/or documentation.

> tia

 
 
 

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. ADO returns null from Excel for some columns (with all numeric values)

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

4. Help sought with RfcConnect C call to MDIS RealityX

5. Object variable or With block variable not set (Trapping SQL errors)

6. Connecting To SQL Server

7. ADO error trapping in VB + SQL Server 2000

8. VB brRead - item missing not invoking on error trap

9. Deadlock errors & vb error trapping

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

11. Error not being trapped with @@error