I have a page that inserts a record to an sql database and I would like to do the following:
(i) Check if a record already exist before trying do an insert
(ii) If a record exist, the page should be able to inform/display a message in a textbox informing the user that the record already exist.
I have seen a number of post on the internet that suggest that one possible solution is to write a sproc and use the T-sql IF EXIST function. However, I have NOT seen a complete code showing (a) how this can be done (b) how to call the sproc from an asp page (c) and MORE IMPORTANTLY how to display a message informing a user that a record already exist i.e. when the record already exist in the database.
Please have anyone got a complete working code that can achieve this preferably in c#?
View Complete Post