Catch SQL Server's RAISERROR message

Discussion in 'ASP .Net' started by =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=, May 12, 2004.

  1. 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.
     
    =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=, May 12, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=

    Catch SQL Server's RAISERROR message

    =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=, May 11, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    21,230
    Hans Kesting
    May 12, 2004
  2. =?Utf-8?B?UmV6YQ==?=
    Replies:
    3
    Views:
    17,954
    Carlos Barini
    Jun 7, 2004
  3. John Black
    Replies:
    8
    Views:
    4,163
    Xenos
    Aug 20, 2004
  4. Adam
    Replies:
    9
    Views:
    577
    red floyd
    Feb 2, 2006
  5. Marteno Rodia

    catch doesn't catch a thrown exception

    Marteno Rodia, Aug 3, 2009, in forum: Java
    Replies:
    5
    Views:
    572
    Daniel Pitts
    Aug 5, 2009
Loading...

Share This Page