What's the trick to catching or handling a raiserror generated out of SQL? Even though I'm iterating through the ado Errors collection, the raiserror is actally coming out as a "Run Time Error". The part in my code where I actually look for errors is not being touched because the runtime error closes the app.
Here's my VB6 code calling my MS SQL SP, and my SQL Raierror . . .
Any help would be most appreciated.
Thank in advance!
Stay Cool Ya'll!
-- Kristin
Here's my VB6 code calling my MS SQL SP, and my SQL Raierror . . .
Code:
Dim adoCmd As New ADODB.Command
Dim adoRs As New ADODB.Recordset
Dim adoErr As ADODB.Error
Set adoCmd = New ADODB.Command
With adoCmd
.ActiveConnection = gConnect
.CommandType = adCmdStoredProc
.CommandText = gcSQLSP_CAPPLUSSRCLOOKUP
Call .Parameters.Refresh
If (Hs > 0) Then
.Parameters.Item("@Scn").Value = Scn
.Parameters.Item("@IdTransaction").Value = Hs
mServiceControlNumber = Scn
mIdTransaction = Hs
Else
.Parameters.Item("@IdTransaction").Value = Scn
mServiceControlNumber = ""
mIdTransaction = Scn
End If
Set adoRs = .Execute
'THE RUNTIME ERROR POPS UP HERE EVEN BEFORE I GET TO THE
'NEXT STATEMENT TO CHECK FOR ERRORS ........
If (adoCmd.ActiveConnection.Errors.Count) Then
Call MsgBox("ADO Connection Error!" + vbCrLf + vbCrLf + "Action : CapPlusSrc_Lookup", vbCritical + vbOKOnly, "Coupons Inc Logging")
adoCmd.ActiveConnection.Errors.Clear
CapPlusSrc_Lookup = False
mCIOriginalTransaction = CIOriginalTransaction.adoErr
End If
Code:
if (@tmpIdTag <> dbo.fxBarcodeCheck(@IdTransaction))
begin
raiserror ('Invalid Check Digit on NRS Store Tag Id', 14, 1)
return (-1)
end
Any help would be most appreciated.
Thank in advance!
Stay Cool Ya'll!
-- Kristin