Forum Moderators: open

Message Too Old, No Replies

Show SQL Server messages

         

bpositive

10:16 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



Hello all,
I am making an auction system using C#, .NET and MS SQL Server.
I have a page to add new products to DB, which works fine.

What I like to have is that, I want to be able to show friendly confirmation and error messages to users.

So it is going to work like this:
- user adds a new product
- if successful there is a message on the page that reads: The products (product name) was successfully added to the database. And form fields are clear, ready for the next product info to be entered.
- if not successful, the message should tell the user and maybe indicates the reason too. Like: the product code used already exists.

Currently for the successful attempts I get the form page with all the fields filled with the entered data and for un-successful one the ASP.NET error page.

Can anybody help please? Does anybody knows about a tutorial or an article or ...?

Thanks a lot.

TheNige

10:53 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



in your stored procedures you can raise custom error messages. So, do the checks yourself for things such as duplicate products before you do the insert in the same sproc and if it is duplicate then raise the error and set the message to what ever you want. Then in the .Net side use Try..Catch and you can return the error codes that you want to the user.