Click here to Skip to main content
16,004,944 members
Home / Discussions / Database
   

Database

 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
nbhairav12315-Jun-04 5:19
nbhairav12315-Jun-04 5:19 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
Anonymous21-Jun-04 12:56
Anonymous21-Jun-04 12:56 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
Antonius_r321-Jun-04 12:57
Antonius_r321-Jun-04 12:57 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
VenkatFor.NET21-Jun-04 17:46
VenkatFor.NET21-Jun-04 17:46 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
Steven Campbell15-Jun-04 16:03
Steven Campbell15-Jun-04 16:03 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
nbhairav12316-Jun-04 4:36
nbhairav12316-Jun-04 4:36 
QuestionMultiple definitions of SqlConnection??? Pin
matthias s.15-Jun-04 2:13
matthias s.15-Jun-04 2:13 
GeneralSqlExceltion.Number not what I expected Pin
Colin Angus Mackay15-Jun-04 0:28
Colin Angus Mackay15-Jun-04 0:28 
With the following SQL an exception is thrown in .NET which is entirely expected. However I'm not sure why the number is not set to the number in my RAISERROR

["..." have been included for brevity]
INSERT topic(topic_name...)
VALUES(@topic_name...)
SELECT @last_error = @@error
IF @last_error <> 0
BEGIN 
	ROLLBACK TRANSACTION
	IF @last_error = 2627
	BEGIN
		RAISERROR(50300, 16, 1, @topic_name) WITH SETERROR
		RETURN
	END
END


With a certain error I want to report out of this stored procedure my own error and I want to be able to pick this up in my C# application with
catch(SqlException SqlEx)
{
    if (SqlEx.Number == 50300)
    {
        // Do something here.
    }
}


If my RAISERROR is not the result of a previous error then everything is fine, the number I put in RAISERROR gets through to my SqlException.

Does anyone have any ideas of how to get this to work the way I want?


"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar

The Second EuroCPian Event will be in Brussels on the 4th of September

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!

My Blog


GeneralRe: SqlExceltion.Number not what I expected Pin
Steven Campbell15-Jun-04 15:55
Steven Campbell15-Jun-04 15:55 
GeneralRe: SqlExceltion.Number not what I expected Pin
Colin Angus Mackay15-Jun-04 20:35
Colin Angus Mackay15-Jun-04 20:35 
QuestionGetting data from MySQL db in ASP.NET? Pin
anderslundsgard15-Jun-04 0:13
anderslundsgard15-Jun-04 0:13 
AnswerRe: Getting data from MySQL db in ASP.NET? Pin
Colin Angus Mackay15-Jun-04 0:20
Colin Angus Mackay15-Jun-04 0:20 
Questionhow i can add two diffrent time Pin
syed saba14-Jun-04 22:10
syed saba14-Jun-04 22:10 
AnswerRe: how i can add two diffrent time Pin
Steven Campbell15-Jun-04 15:48
Steven Campbell15-Jun-04 15:48 
GeneralRe: how i can add two diffrent time Pin
syed saba15-Jun-04 19:07
syed saba15-Jun-04 19:07 
GeneralCreate report based on sql string Pin
Mekong River14-Jun-04 5:37
Mekong River14-Jun-04 5:37 
GeneralUsage of SqlDataAdapter .... Pin
sanjaysagrawal14-Jun-04 4:45
sanjaysagrawal14-Jun-04 4:45 
GeneralRe: Usage of SqlDataAdapter .... Pin
VenkatFor.NET14-Jun-04 5:04
VenkatFor.NET14-Jun-04 5:04 
GeneralRe: Usage of SqlDataAdapter .... Pin
nbhairav12314-Jun-04 5:15
nbhairav12314-Jun-04 5:15 
GeneralRe: Usage of SqlDataAdapter .... Pin
VenkatFor.NET14-Jun-04 5:24
VenkatFor.NET14-Jun-04 5:24 
GeneralPulling the latest entry for a product BY DATE from a table Pin
lostsheep00714-Jun-04 2:49
lostsheep00714-Jun-04 2:49 
GeneralRe: Pulling the latest entry for a product BY DATE from a table Pin
Thea Burger14-Jun-04 4:09
Thea Burger14-Jun-04 4:09 
GeneralRe: Pulling the latest entry for a product BY DATE from a table Pin
lostsheep00715-Jun-04 16:59
lostsheep00715-Jun-04 16:59 
GeneralRe: Pulling the latest entry for a product BY DATE from a table Pin
Colin Angus Mackay15-Jun-04 4:26
Colin Angus Mackay15-Jun-04 4:26 
GeneralRe: Pulling the latest entry for a product BY DATE from a table Pin
lostsheep00715-Jun-04 17:00
lostsheep00715-Jun-04 17:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.