asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search








Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Possible Ways to Write Error Messages
By 15 Seconds Discussion List
Rating: 1.8 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Jamal Aljahmi Asks a Seemingly Simple Question:

    I'm doing some error handling to check for ado sql error. Once the error is found I would like to redirect to the calling form but write a message at the top or bottom of the calling form. Any suggestions on how to do that.

    Chaz Punches Out This Code:

    Well, take this psuedo code for example:

    
    TestScript.asp
    
    Dim variables
    
    set variables = to form input
    
    if there are form input errors then
    errFlag = true
    errMsg = "there were form input errors"
    
    if this is a form submission then (ie: if request("btnSubmit") <>
    "" then)
    update the database
    
    if there were datbase update errors then
    errFlag = true
    errMsg = "there were database errors"
    
    query the database to get the latest data
    
    if errFlag then
    display errMsg
    
    display queried data
    
    

    The Plot Thickens. Says Jamal:

    Oh, your doing the error message on the same page. I wanted to write the error message back to the redirected page.

    Puzzled, Chaz Adds:

    Well, if you must have it on the redirected page then you can pass the message in the URL. Or you could come up with a complicated scheme where you have standard error messages in a database and then all you have to pass on the URL are ID numbers for the appropriate message. Seems pretty complicated when you can just put all the processing on one page with everything you need.

    Rob Chartier Then Posits:

    You could have a table, with custom error messages and IDs (hard-coded errors) and when you redirect back and need to show the errors, you only need to pass the custom message id, query the DB to get the error message, and then show it.

    You could even go so far as having a table with just ids and error message (dynamic errors).

    Your error handler will log to that error table, and when it redirects back, it passes those NEW ids over, pick them up and show them. This would be kinda recommended because then you will have a good log ofall of the errors. You can analyse and check to see what are common errors and re-evaluate your usability for the site like say, the "signup.asp" page has a ton of problems with the "first name" field never being filled in. When upon discovery you can reformat the signup.asp page to show the first name field more prominently etc..

    This conversation string was taken from the 15Seconds ASP Listserv on 1/24/01. If you have an ASP-related question or would like to share some of your knowledge with others, you may join the list by clicking here.

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry



    JupiterOnlineMedia

    internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info


    Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers