Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Receiving values from 'Raiseerror' and 'Print'
Message
De
24/01/2001 12:00:58
Greg Coopman
Gc Systems Corporation
Hollywood, Floride, États-Unis
 
 
À
20/12/1999 17:53:33
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00306407
Message ID:
00467959
Vues:
14
My stored procedure contains several RaiseErrors to return Warning information to the VB Client via ADO with severity levels 1 - 15. The problem is that the ADO Errors Collection that is received back only identifies the first RaiseError and none of the others. The Errors.Count on VB is always 1 no matter how many RaiseErrors I put in the code and I also know the commands after the RaiseErrors are continuing to execute.

--------------
SQL Code:
--------------
CREATE PROCEDURE DeleteMatrix_sp
@MatrixID UNIQUEIDENTIFIER
AS

DELETE Testgc_tbl

INSERT Testgc_tbl
(testfield)
VALUES ('Greg')

RAISERROR( 'AL03This is a test', 9, 1) WITH LOG, SETERROR
RAISERROR( 'AL03This is a test2', 11, 2) WITH LOG, SETERROR
RAISERROR( 'AL03This is a test3', 12, 3) WITH LOG, SETERROR
RAISERROR( 'AL03This is a test4', 10, 1) WITH LOG, SETERROR

DELETE FROM MatrixUser_Tbl
WHERE [MatrixID] = @MatrixID

EXEC LogDebug_sp
'Delete from Matrix_Tbl'

DELETE FROM Matrix_Tbl
WHERE [ID] = @MatrixID

-------------
VB code:
--------------
Private Function ProcessErrors(oConn As ADODB.Connection, _
ByVal Source As String, _
ByVal Category As String) As Boolean

Dim oError As ADODB.Error
Dim sPrefix As String
Dim lLogVal As Integer

moLog.WriteLogEntry 0, crLogDebugOut, "UniDAL.CDataAccess", "ProcessErrors", "Errors.Count = " & oConn.Errors.Count

For Each oError In oConn.Errors
sPrefix = Left$(oError.Description, 4)
If Left$(sPrefix, 2) = "AL" Then
lLogVal = CInt(Right$(sPrefix, 2))
moLog.WriteLogEntry oError.NativeError, lLogVal, Source, Category, Right$(oError.Description, Len(oError.Description) - 4)
Else
' error found
ProcessErrors = True
moLog.WriteLogEntry 54321, crLogError, Source, Category, oError.Description
End If
Next oError
End Function
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform