Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

I have asp.net website using c#

n backend sql server 2008 r2.

where i'm writing stored procedure for insertion.

in my stored procedure.

i have written this code:

IF EXISTS
(
        SELECT * from tbl_jobposted where Posted_Date = @PostedDate and UnitID = @UnitID
)

BEGIN
    RAISERROR  20000 'This Job Already Posted ! '
    RETURN(1)
END


i want to show this message, what i got from the stored procedure, to the user on the screen.

how can i fetch that error n display it on the page.

plz help me.

Thanks
Posted
Updated 20-Sep-14 9:04am
v3

1 solution

See this answer here. It says,

"It depends on the severity of your RAISERROR. Severities 1-10 are considered information messages and do not break the flow of your C# client, ie. they don't throw exception. These information messages will trigger the InfoMessage event on your connection."
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900