This is a discussion on "how to do an asp friendly error?" within the Classic ASP section. This forum, and the thread "how to do an asp friendly error? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
how to do an asp friendly error?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
how to do an asp friendly error?
well...in my database(ACCESS), i have made two field to be a "PRIMARY KEY".
When i do the testing by entering the same value to this field in my ASP form, this is the IE error page saying something about the PRIMARY KEY! ---------------------------------------------------------------------- Technical Information (for support personnel) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. /admin/insertClassroomInfo.asp, line 90 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Page: POST 55 bytes to /admin/insertClassroomInfo.asp --------------------------------------------------------------------- but instead of the IE error reporting them, i want my own Error Reporting (errorReporting.asp) page to be displayed! with my own message writen inside it! HOW TO DO THIS SO CALL AN ASP USER FRIENDLY ERROR PAGE????
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|
|
|||
|
Maybe we could do an article on this guys? (Sorry monie I don't know the answer myself, but I'm sure Rob, Catalyst and Smokie do...lol)
|
|
||||
|
Actually.... all this needs is a call to the database FIRST.... Select records with the matching key you want to insert. If there are any records returned, then you know that inserting a record would fail and raise an error.... you can handle it from there.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Like Rob says there's better ways to do it, but if you do want the error thing then read up on using:
On Error Resume Next You can then check the ERR object to see if any errors have happened and write out a message or redirect to a page based on the error type/number. Google it for samples, etc. |
|
|||
|
Well if you have access to the server and IIS, you can choose to not display errors to the user, or you can choose your own ASP page which runs when different errors occurs, or you can do this.
Insert this at the top of your ASP page:
Then after any ADO call that accesses the database, put the following lines:
|
|
|||
|
thanx smokie, that helps me alot
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />Originally posted by Sirkent
Maybe we could do an article on this guys? (Sorry monie I don't know the answer myself, but I'm sure Rob, Catalyst and Smokie do...lol)<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote"> I'm more impressed that Rob, Catalyst and Smokie actually answered in the order I said their names [:P] |
![]() |
| Tags |
| asp, friendly, error |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Are JavaScripts SEO Friendly? | maneetpuri | Search Engine Optimization (SEO) | 4 | Jan 16th, 2008 20:16 |
| Pro design and CMS that is SE friendly | paulhudson | Starting Out | 11 | Jun 18th, 2007 23:29 |
| friendly suggestion from the new guy... | bg38 | Webforumz Suggestions and Feedback | 12 | Sep 20th, 2006 12:12 |