1
Reply

How to catch Primary key exception ???

onlybhavin

onlybhavin

Apr 13 2005 2:25 AM
2.6k
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)