|
|
|
|
|
| | |
|
Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Re: Error Trapping |
From: |
Harlan |
Date: |
3/22/1999 2:27:21 PM |
IP: |
206.222.20.2 |
another way to do error handling, is to "catch" spacific errors. you can do this in your errorhandler, or you can resume next, and do it after the possible error would occure. Here's an example that resumes next, and ignores the error number that tosses when the record already exists.
'create the sql insert for questions
sqlQuestion = "INSERT INTO questions (question,value) VALUES " & _
"('" & strQuestion & "'," & intValue & ")"
'insert it
On Error Resume Next
DB.Execute (sqlQuestion)
'if the question already existed, ignore the error thats tossed back
If Err.Number = -2147217900 Then
'do nothing, its ok for now.
ElseIf Err.Number <> 0 Then
'if there is an error other than the question already exists, send it to the error handler
GoTo ErrorHandler
End If
|
Previous Message
|
|
|
|
|
|
|
|
|
|
|
|