1
Answer

How to catch Primary key exception ???

onlybhavin

onlybhavin

20y
2.6k
1
Hi, I m faceing problem in catching exception. I m using sqlserver as database. I m takeing User ID as input in textbox for insert query. Now when i press button save. It throws exception related to primary key. It gives message of its own. but i want to give my own message for it. When primary key constraint violates i want to give message ... " USER ID ALREADY EXIST PROVIDE ANOTHER ID." Is it possible ??? How can i do it ? Same way exception handling for open connection & close conection & other database related exception, I want to give my own message not .net specific. What can i do??? Please guide me step by step. thank u, bhavin gajjar
Answers (1)
0
Osman Esen
NA 10 2.6k 12y
My PC har to communicate with a kit. For instance, i have to write a random value of power consumption in the textbox, and send that value to the kit.

It is important for the kit to receive the values as a number, because the kit controls a "plastic made" flower, which will react dependent on the power value. So the only job i will do with C#, is to write the values in the textbox and send those values with pressing "send" button.


0
Satyapriya Nayak
NA 53k 8m 12y
Please elaborate it more