Navicerts
asked on
SQL Server - displaying PK errors
Hello,
I am writing a ASP.NET page for the user to create some new records for a particular process that happens. If they attempt to create records for a record set that has already gone through the process the ASP page gives an ugly error message about not being able to see the error message due to security reasons.
I do the same thing on the local server and i get the following primary key violation error message...
"Violation of PRIMARY KEY constraint 'PK_Process'. Cannot insert duplicate key in object 'Process'. The statement has been terminated. "
This is correct, and what i intended the database to do but i would like a nicer looking way to display the error message for the end user.
Thanks!
-Navicerts
I am writing a ASP.NET page for the user to create some new records for a particular process that happens. If they attempt to create records for a record set that has already gone through the process the ASP page gives an ugly error message about not being able to see the error message due to security reasons.
I do the same thing on the local server and i get the following primary key violation error message...
"Violation of PRIMARY KEY constraint 'PK_Process'. Cannot insert duplicate key in object 'Process'. The statement has been terminated. "
This is correct, and what i intended the database to do but i would like a nicer looking way to display the error message for the end user.
Thanks!
-Navicerts
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, i have written custom validators before but none that evaluate info returned from a query, just ones that validate date's to make sure they are dates, text box's to make sure they are filled in, excetra. I'll give this a shot and post back. Thank You.
-Navicerts
-Navicerts
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just an update, I am changing the page to accept values from drop down lists instead of text box's. If i narrow down the avalible choices based off current date the list in the drop down menu goes to a managable size. This is my first time making a page in Visual Studio .NET as opposed to ASP Matrix so evreything is a bit of a challenge.
After i get the drop down lists working ill work on that validation control and get back to you guys. Thanks again for your help.
-Navicerts
After i get the drop down lists working ill work on that validation control and get back to you guys. Thanks again for your help.
-Navicerts
ASKER
Once i had pull down's instead of text box's i was able to narrow down the record set so that it should be impossible to select something that will not work throught my stored proceedures. I guess im all set with custom validation controls that pass a value for now, did it through SQL.
Thanks all for the help.
-Navicerts
Thanks all for the help.
-Navicerts
ASKER
With custom errors, it will still go to a seprate page where the user is going to have to hit "back" and try to submit again. this is a bit ugly. Perhaps i can handle this by putting the SQL statements in a stored proceedure and making some type of "If" statement?
I'll look into the options you wrote here though, thank you so far.
-Navicerts