Click here to Skip to main content
13,054,779 members (75,303 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, I have a question, I have a stored procedure in sqlserver the return 2 variables, in this stored procedure I try catched error, so for the C# this procedure never exit with error.
I can use

but I don't know if I have same errors, so I don't know what is the best way manage this situation...

A little improve: I know exactly how to catch error in t-sql and in C#, the problem is how to pass all the information that I catch in sql through C#, for example, without error the SP return 2 columns, but with error it return for example 5 columns, and I don't know a priori
Posted 23-Jan-13 4:42am
Updated 24-Jan-13 4:25am
jibesh 24-Jan-13 15:28pm
what are you trying to do here? you want return 5 Columns when error comes or it returns 5 columns when error comes and you wont want that? is that true? can you elaborate your question.

or when a error occurred in a SP you want that information to be handled and passed to your C# code to display at user side? if that was the case instead of putting exception inside the SP why dont you handle SQLException/exception in your C# code.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have a look at these articles you may get clear picture how to handle a try catch in sql.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100