Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old February 1st, 2007, 04:31 PM
Authorized User
 
Join Date: Feb 2007
Location: Winnipeg, Manitoba, Canada.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, this is getting weird.
After changing things like you suggested, I now get an error back up at
Dim sConnection
The error says name redifined and is pointing at the s in sConnection.
I'll try fixing this, but any help would be great!


Now is the only thing that's real.
Reply With Quote
  #12 (permalink)  
Old February 1st, 2007, 04:33 PM
Authorized User
 
Join Date: Feb 2007
Location: Winnipeg, Manitoba, Canada.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To add to that:
Do I really need the #include file up near the top? It really just says the same thing as the connection string in my document.

Now is the only thing that's real.
Reply With Quote
  #13 (permalink)  
Old February 1st, 2007, 04:41 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ok, I want you to entertain me for a moment ;] Fire up notepad and place this in the editor.

<%@Langauge=VBScript%>
<%Option Explicit%>

<%
Dim objConn
Dim sConnection
Dim dbPath
Dim rsgameused

dbPath = "/db/HockeyCards.mdb"
sConnection = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=''& Server.MapPath(dbPath)"
Set objConn = Server.CreateObject("ADODB.Connection")
Set rsgameused = Server.CreateObject("ADODB.RecordSet")
objConn.Open sConnection

strSQL = "SELECT * FROM" & tablename
rsgameused.Open strSQL, sConnection

rsgameused.close
Set rsgameused = Nothing
objConn.Close
Set objConn = Nothing
%>

go to file -> save as name the file "test.asp" and place it in your web folder. Call it up in a browser window and see if it bombs on you.

YOU must include adovbs.inc as it contains all the constants used to work with a database (I notice that you do NOT have this include anywhere in your code.) adovbs.inc should be on your server, do a file search for it and place it in the root of your web directory along side test.asp.

(If you can't find adovbs.inc on your pc you can download it from here: http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=123 )

And your error means that sConnection is defined twice in your code e.g.

Dim sConnection
//code
Dim sConnection <--error is thrown here.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
  #14 (permalink)  
Old February 1st, 2007, 05:12 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

I haven't really looked at your code as it's a bit too much to digest at once.

However, if I were you, I'd start with a proper connection string. Take a look at www.connectionstrings.com for some ideas.

You can use Server.MapPath to translate the virtual path to the database to a physical path, in case you don't know exactly where the database resides.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #15 (permalink)  
Old February 1st, 2007, 05:25 PM
Authorized User
 
Join Date: Feb 2007
Location: Winnipeg, Manitoba, Canada.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok,
here's what happened:
Active Server Pages error 'ASP 0221'

Invalid @ Command directive

/test.asp, line 1

The specified 'Langauge="VBScript"' option is unknown or invalid.

Wha???? Yes, I added quotes around VBscript. I think they should be there.

Now is the only thing that's real.
Reply With Quote
  #16 (permalink)  
Old February 1st, 2007, 05:29 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Language is misspelled.



================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
  #17 (permalink)  
Old February 1st, 2007, 05:31 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

;)

Langauge should be Language .....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #18 (permalink)  
Old February 2nd, 2007, 02:04 PM
Authorized User
 
Join Date: Feb 2007
Location: Winnipeg, Manitoba, Canada.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi. Sorry I disappeared for a while.
Anyway, dparsons, I tried the code you gave me. I copied and pasted it into a new file called test.asp. I did have to download the adovbs file. Anyway I get the following error:

Microsoft OLE DB Service Components error '80040e73'

Format of the initialization string does not conform to the OLE DB specification.

/test.asp, line 14

This seems strange since it does seem to conform to the OLE DB specification.
Any thoughts?

Now is the only thing that's real.
Reply With Quote
  #19 (permalink)  
Old February 2nd, 2007, 02:13 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Replace the connection string with this: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath & ";"

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
  #20 (permalink)  
Old February 2nd, 2007, 02:27 PM
Authorized User
 
Join Date: Feb 2007
Location: Winnipeg, Manitoba, Canada.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK. I think we're getting somewhere.
I did have to modify more than that. Like Data Source = & Server.MapPath(dbPath) &";".
Then there were other errors I was able to fix. Now it give this message:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression '* FROMbigcardtable'.

/test.asp, line 19

What operator is missing?

Now is the only thing that's real.
Reply With Quote
Reply


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
Javascript Access Database Query panuvin Javascript How-To 28 May 9th, 2008 01:53 PM
Displaying query from three tables slims07 .NET Framework 2.0 8 April 2nd, 2008 10:47 AM
Displaying data from access database tusharpat@gmail.com Classic ASP Basics 1 January 24th, 2006 06:35 PM
displaying the query lanita PHP How-To 6 August 23rd, 2004 11:11 PM
Database access from java, INSERT query problem nitusincog BOOK: Beginning Java 2 1 July 21st, 2003 10:26 AM



All times are GMT -4. The time now is 07:12 AM.


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