Catch SQL Server's RAISERROR message

G

Guest

Hello everyone

I have a HUGE database, with very complex stored procedures that handle every possible error and the passed it to an ASP site with RAISERROR

Now I need to use that same database on an ASP.NET site, but all I can do is

Tr
Common.ExecuteNonQuery(QueryString, Common.Connection
Catch Ex As SqlExceptio
Result.Text = Ex.Messag
Finall
Common.Connection.Close(
End Tr

I really NEED to have the RAISERROR message... how can I do this

I tried some people's advice, by doing this

Dim myError As OdbcErro
For Each myError In Ex.Error
Result.Text = Result.Text & myError.Message() & "<br/>
Nex

But there I only get the elements

[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK_User'. Cannot insert duplicate key in object 'User'
[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated

I DON'T get my RAISERROR message... Even though if I execute this Stored Procedure on the Query Analyzer, and I get this

Server: Msg 2627, Level 14, State 1, Procedure InsertCompany, Line 7
Violation of PRIMARY KEY constraint 'PK_User'. Cannot insert duplicate key in object 'User'
The statement has been terminated
Server: Msg 50000, Level 16, State 1, Procedure InsertCompany, Line 8
The username 'emarinelli' has already been taken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top