Click here to Skip to main content
15,918,275 members
Home / Discussions / Database
   

Database

 
GeneralRe: Returning a unique value Pin
Vicetta15-Jun-04 22:41
Vicetta15-Jun-04 22:41 
GeneralInserting & Updating A Row With Unique Key Pin
sanjaysagrawal15-Jun-04 2:45
sanjaysagrawal15-Jun-04 2:45 
GeneralRe: Inserting & Updating A Row With Unique Key Pin
VenkatFor.NET15-Jun-04 5:14
VenkatFor.NET15-Jun-04 5:14 
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 
From a design point of view, it is generally a bad idea to use data which has business meaning to a primary key. This is because data that has meaning has a nasty habit of changing - and changing primary keys can be a messy procedure.

That aside, you would face the same situation if you had a unique index on the column, so I will try and answer your question...

I have found that for problems that have a low likelihood of occurring (such as inserting duplicate data), it is simply best to try and do it, and then handle any resulting error. This is because you're going to have to handle errors anyway, and it does not make sense to spend a lot of time programming around it.

So, I would have a single SP that does the insert, and if the insert returns an error indicating a uniqueness constraint, then I would handle that in a user-friendly manner.
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 
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 

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.