Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 11th, 2005, 04:05 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default catching the database exceptions

I am about to start the design & development of a fairly big ASP.Net application with SQL Server 2000. There are many a number of entities, relationship between entities, constraints and complex data integrity rules.

I would like to depend on database features for ensuring data integrity. That is by using check constraints, unique constraints, foreign key constraints, triggers and the nullable property of fields, I will set all the data integrity rules in the database. I would like to avoid any explicit ASP.Net validations in aspx / cs / http handler files. Instead, I want to catch the db errors and show appropriate error messages. It should be possible to show appropriate error message (Not just showing "some error in the submitted data etc. etc.").

My doubt is, whether this is possible ? If yes, how can I do it ?

NB : Previously, I was checking all posted data with either validator controls or server side ASP.Net. This is very difficult and not maintainable also. Each validation change requires integrity rule changes at database level as well as code changes. I would like to get rid of script level data validations.

Thanks

Madhu
  #2 (permalink)  
Old March 11th, 2005, 01:02 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can do this using Try...Catch statements. See the help files for specifics.
  #3 (permalink)  
Old March 11th, 2005, 03:13 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

For sql2000

Try
....
Catch e as SqlClient.SqlException
...
Finally
....
End Try

Ahmed Ali
Software Developer
  #4 (permalink)  
Old March 12th, 2005, 12:45 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Thank you Benson and Ahmed. I am trying this now and seems to be possible.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
exceptions Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 October 18th, 2008 12:34 PM
Catching Up John Kauffman BOOK: Beginning ASP.NET 2.0 and Databases 2 October 2nd, 2006 05:04 PM
catching error darkhalf Javascript 4 December 14th, 2005 01:44 PM
Catching exceptions thrown from an event... jacob C# 5 December 6th, 2005 12:48 PM
When to use Exceptions kcraft Pro PHP 1 January 15th, 2005 02:37 PM



All times are GMT -4. The time now is 09:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.