Rocky Rocky

Rocky Rocky

  • NA
  • 317
  • 151.7k

How to Get Error message from procedure into display on c#?

Aug 6 2013 3:56 AM
Hai friends,

I ve the concept for making draft when user use to draft for already existed date on table ll show error message and dispaly on screen


My sql code:
============


alter procedure save_draft
(
@username varchar(20),
@departure datetime ,
@ErrorMsgID int output


)
as
begin
declare @userid varchar(20)


select @userid=user_id from users where username=@username

set @ErrorMsgID = @@Error




if exists(select convert(varchar, a.departuredate, 106)as DepartureDate from onward_journey a inner join travel_request b on a.request_id=b.request_id where b.user_id=@userid)
begin
RAISERROR ( ' Already you saved on Same Date ',16,1)
return
end


update travel_request set active_tag='Y' where request_id=IDENT_current('travel_request')
end

now i was struck from get error and display on screen?


Answers (49)