December 2, 2005 at 6:13 am
is there a way to recuperate in visual basic the severity level of an error raised by RAISERROR inside a sp.
I looked into the ADODB.Error object of the ADODB.Connection object but did not find any property that contains the severity of the Raiserror command.
Bart
December 5, 2005 at 8:00 am
This was removed by the editor as SPAM
December 5, 2005 at 1:34 pm
did you try to pass it as an output parameter from SP?
Regards,Yelena Varsha
December 6, 2005 at 2:11 am
Adding an extra output parameter to all stored procedures would have an important impact on all stored procedures and vb code. And it would only work when the stored procedure completes in a normal way.
I'm looking in using the severity property of RAISERROR to make a distinction between the different errors that can occure in the sp. (Ex simple warning, critical error, improper use, ....) This info should be returned to vb so that the GUI knows how to display the msgs.
December 6, 2005 at 7:37 am
Not that I am aware of.
The only way I can think of getting the severity is to query the master.dbo.sysmessages table.
Far away is close at hand in the images of elsewhere.
Anon.
December 6, 2005 at 8:20 am
When you catch an sqlexception, it has an sqlerror object, which has a property "Class". this is the severity value in sql server. the sqlerror class has other properties like Source, Message, LineNumber etc.
December 6, 2005 at 8:29 am
I'm still on the VB6 platform with this project. Do you know if there is an equivalent for the sqlexception object in VB6? I checked the ADODB.Error object but it doesn't have the 'class' property you mentioned. This obcjet only has following properties : 'Description,HelpContext,HelpFile,NativeError,Number,Source,SQLState' !
AS i'm working on a shared sql production server I do not have access to the master.dbo.sysmessage table. Therefor I make my RAISERROR msgs inline, and can't use a query on sysmessage table afterwards to find back the severity level.
Example of a raiserror msg inmy tsql code:
RAISERROR( 'You are not authorized to enter measurements for physical stock %d.',16,1,@PhystockID)
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply