[SOLVED] Database Connection Error Message

This is a discussion on "[SOLVED] Database Connection Error Message" within the Classic ASP section. This forum, and the thread "[SOLVED] Database Connection Error Message are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Oct 29th, 2007, 05:15
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
[SOLVED] Database Connection Error Message

I wanted to do an error massage in my ASP-MySQL page more similar to what I've learned in PHP.

Can this be done in ASP page? Thanks..

PHP: Select all

// 1. Create a database connection
$connection mysql_connect("localhost""root""mypassword");
if (!
$connection){
      die(
"Databse connection failed: " mysql_error()));

Attached Images
File Type: png error.png (3.7 KB, 27 views)
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Oct 29th, 2007 at 06:07.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 29th, 2007, 15:09
Up'n'Coming Member
Join Date: Aug 2007
Location: Haverhill
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Database Connection Error Message

Hi Monie,

Have you tried using something like this
HTML: Select all
<%
If Err.number <> 0 then     'if there is an error 
response.write Err.number     'write out the error number
response.write Err.source     'write out the error source
response.write Err.description     'write out the error description
End If
%> 
I'm not entirely sure it will produce the same kind of output as the php code you've posted.

Last edited by Phil; Oct 29th, 2007 at 15:13.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 30th, 2007, 01:18
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Database Connection Error Message

Yeah I've tried that, but I am looking for something more specific, like PHP does!
Thanks..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 1st, 2007, 07:33
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Database Connection Error Message

Any one with ASP geek might help?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 1st, 2007, 14:46
Junior Member
Join Date: Oct 2007
Location: Israel
Age: 21
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Database Connection Error Message

as phil said you can do the error object http://www.w3schools.com/ado/ado_ref_error.asp

but i think that the die statement is more like "on error resume next"
you can look for it in this ADD sample
http://www.w3schools.com/ado/ado_add.asp

you can play with them both to make your own message or a real ADO error jibrish text
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 2nd, 2007, 03:34
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Database Connection Error Message

Thanks Eran, really helps me with all the question in mind
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 2nd, 2007, 08:08
Junior Member
Join Date: Oct 2007
Location: Israel
Age: 21
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Database Connection Error Message

no problem :]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Getting the &quot;Microsoft JET Database Engine error '80040e14'&quot; error. VegaLA Classic ASP 3 Jan 26th, 2008 00:12
[SOLVED] Easiest way to open database connection! Monie Databases 4 Nov 1st, 2007 07:35
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Database connection fogofogo Classic ASP 7 Dec 5th, 2005 14:25
Database Connection Strings Smokie Classic ASP 0 Aug 7th, 2003 09:51


All times are GMT. The time now is 05:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42