Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
GeneralRe: giving error message according to Sql data PinPopular
Nish Nishant8-Dec-10 9:35
sitebuilderNish Nishant8-Dec-10 9:35 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 9:37
mentorNot Active8-Dec-10 9:37 
GeneralRe: giving error message according to Sql data Pin
Nish Nishant8-Dec-10 9:41
sitebuilderNish Nishant8-Dec-10 9:41 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 9:57
mentorNot Active8-Dec-10 9:57 
GeneralRe: giving error message according to Sql data Pin
Nish Nishant8-Dec-10 9:59
sitebuilderNish Nishant8-Dec-10 9:59 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 10:05
mentorNot Active8-Dec-10 10:05 
GeneralRe: giving error message according to Sql data Pin
Nish Nishant9-Dec-10 6:29
sitebuilderNish Nishant9-Dec-10 6:29 
GeneralRe: giving error message according to Sql data Pin
Nagy Vilmos8-Dec-10 9:47
professionalNagy Vilmos8-Dec-10 9:47 
In principal you are correct. But remember that exceptions are there for exceptional cases; pun intented.

In the case of creating a new record where you expect the key to be unique, I agree with the others that using an exception is the correct approach. If there is a good chance that the key will not be unique then a different approach would be justified. There I would try to read the record with the key, if it does not exist then I would do the insert. I would however still have the try/catch on the insert.


Panic, Chaos, Destruction.
My work here is done.


or "Drink. Get drunk. Fall over." - P O'H

OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre

GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 10:04
mentorNot Active8-Dec-10 10:04 
GeneralRe: giving error message according to Sql data Pin
PIEBALDconsult8-Dec-10 16:12
mvePIEBALDconsult8-Dec-10 16:12 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 16:21
mentorNot Active8-Dec-10 16:21 
GeneralRe: giving error message according to Sql data Pin
Eddy Vluggen8-Dec-10 9:37
professionalEddy Vluggen8-Dec-10 9:37 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 9:41
mentorNot Active8-Dec-10 9:41 
GeneralRe: giving error message according to Sql data Pin
Nish Nishant8-Dec-10 9:43
sitebuilderNish Nishant8-Dec-10 9:43 
GeneralRe: giving error message according to Sql data Pin
Eddy Vluggen8-Dec-10 9:53
professionalEddy Vluggen8-Dec-10 9:53 
GeneralRe: giving error message according to Sql data Pin
Nish Nishant8-Dec-10 9:57
sitebuilderNish Nishant8-Dec-10 9:57 
GeneralRe: giving error message according to Sql data Pin
PIEBALDconsult8-Dec-10 14:30
mvePIEBALDconsult8-Dec-10 14:30 
GeneralRe: giving error message according to Sql data Pin
Mycroft Holmes8-Dec-10 12:00
professionalMycroft Holmes8-Dec-10 12:00 
JokeRe: giving error message according to Sql data Pin
Keith Barrow8-Dec-10 10:32
professionalKeith Barrow8-Dec-10 10:32 
AnswerRe: giving error message according to Sql data Pin
Pete O'Hanlon8-Dec-10 11:02
mvePete O'Hanlon8-Dec-10 11:02 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 11:46
mentorNot Active8-Dec-10 11:46 
GeneralRe: giving error message according to Sql data Pin
AspDotNetDev8-Dec-10 11:51
protectorAspDotNetDev8-Dec-10 11:51 
GeneralRe: giving error message according to Sql data Pin
Not Active8-Dec-10 12:10
mentorNot Active8-Dec-10 12:10 
GeneralRe: giving error message according to Sql data Pin
Pete O'Hanlon8-Dec-10 12:30
mvePete O'Hanlon8-Dec-10 12:30 
GeneralRe: giving error message according to Sql data Pin
AspDotNetDev8-Dec-10 11:50
protectorAspDotNetDev8-Dec-10 11:50 

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.