page error number 2!!

This is a discussion on "page error number 2!!" within the Classic ASP section. This forum, and the thread "page error number 2!! are both part of the Program Your Website category.



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

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 28th, 2004, 20:00
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
page error number 2!!

ok, i have inc_menu.asp, which has this code for the first few lines:

Code: Select all
Home


<%
Set conn = server.createobject("adodb.connection")
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("data.mdb")
conn.Open DSNtemp

sql = "SELECT * FROM pages"

Set rsPage = conn.Execute(sql)
When i view the pages which include it on my own pc, i get no error. However, i get this on the server:

Code: Select all
An exception occurred: 'Open' 

/benbacardi/wsc/includes/inc_menu.asp, line 6
or sometimes the error is "Unspecified" but the same line... whats going wrong? the website is www.websamba.com/benbacardi/wsc

  #2 (permalink)  
Old Sep 28th, 2004, 20:02
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
in fact, just checked it out, and its where any connection to the database occurs
  #3 (permalink)  
Old Sep 29th, 2004, 08:08
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Code: Select all
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("data.mdb") & ";"
...or try actually using a DSN.
  #4 (permalink)  
Old Sep 29th, 2004, 09:44
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
I think what *may* be happening Ben, is that your database is not being found.

I would do as Smokie suggests, and set up a system DSN. I'm sure you host will allow for a DSN.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #5 (permalink)  
Old Sep 29th, 2004, 10:21
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
the problem may be that you're using a physical path to find the database.

e.g.:
let's say you database is at the root of your site. so:
www.yoursite.com/data.mdb

server.mappath("data.mdb") returns:
www.yoursite.com/data.mdb

if you view a page on the root of your site, it works fine. e.eg:
www.yousite.com/index.asp

but if you include the inc_menu.asp file in a page within a folder, e.g:
www.yoursite.com/help/inc_menu.asp
then you'll get an error because the server.mappath("data.mdb") function will now return:
www.yoursite.com/help/data.mdb
and your database won't be found....

if that's the problem, just use a virtual path
server.mappath("/data.mdb")
and it will always point to the root....
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #6 (permalink)  
Old Sep 29th, 2004, 10:26
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Thats good advice spinal. To add to it though, I would still recommend using a system DSN, or least moving the database out of the root into an obcurely named folder... similarly give the database an obscure name.

Having a DB called data.mdb in your root is about as unsecure as it gets.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #7 (permalink)  
Old Sep 29th, 2004, 16:12
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
oh ok then lol

actually, its just something that happens on the server from time to time, it often allows the site to work, sometimes not... whats a DSN, and once i've set one up how do i use it in my code?
  #8 (permalink)  
Old Sep 29th, 2004, 17:19
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
let me try this one.....
Data Source Name is a key registered on the server which stores the physical path of your database.

so you'd use:
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;DSN=MyMenuDatabase"

where "MyMenuDatabase" holds the path to your database

right?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #9 (permalink)  
Old Sep 29th, 2004, 17:24
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Yes Spinal.... essentially, this is correct. You Hosting company usually makes provision for setting up DSN's.

Log-in to your domain control panel to access it. If you dont have the option, then email them.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #10 (permalink)  
Old Sep 30th, 2004, 08:18
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
Its like storing your connection string on the server.

Spinal, i dont think you connect to it like that, i have always done it like this: DSNTemp = "DSN=MyDSN"

I dont think you need to specify the provider because you choose the provider when you setup the DSN on the server.
  #11 (permalink)  
Old Sep 30th, 2004, 08:46
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Well spotted Mr Connection String
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #12 (permalink)  
Old Sep 30th, 2004, 13:17
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
I wouldn't know coz I don't use DSN but I was just trying to get the concept accross.

either way, please accept my most sincere appology dear lord of all connection strings. I shall never fail you again.
:wink:
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #13 (permalink)  
Old Sep 30th, 2004, 13:19
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
lol
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #14 (permalink)  
Old Sep 30th, 2004, 14:03
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
hey, no worries :wink:
Closed Thread

Tags
page, error, number

« id | table color? »
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
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
number of php includes on one page? Lchad PHP Forum 7 Apr 4th, 2007 22:01
Error Page / .htaccess Problem lucidspoon PHP Forum 0 Dec 21st, 2005 20:41
Remove page number malambing57 Classic ASP 1 Oct 14th, 2004 08:47
page error benbacardi Classic ASP 11 Sep 27th, 2004 17:01


All times are GMT. The time now is 00:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs 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 43