Combining SQL `raiserror` with `select` in C# -


i want know if there way of using both sql raiserror , retrieving selected result in c#. executereader() in c# throw exception when raiserror occurs, still want use reader capture data returned.

below simplified example. if not possible use raiserror general cases , select specific cases.

if (some-error) begin     select  @message = 'error: script made booboo',             @state = 'state info'     raiserror (@messsage, 16, 1)     goto exit_sp end  exit_sp:     select  @message 'message', @state 'state' 

if lower severity 10 or below (from memory) not raise exception, available via infomessage event on connection. note, however, because of how tds works, should ensure read() etc end of all results; example, if have multiple selects , then raiserror, , read first select before dropping data-reader, there chance won't see message (the tds killed).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -