Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2007, 04:31 PM
Authorized User
 
Join Date: Feb 2007
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.
 
Old February 1st, 2007, 04:33 PM
Authorized User
 
Join Date: Feb 2007
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.
 
Old February 1st, 2007, 04:41 PM
Wrox Author
 
Join Date: Oct 2005
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^^
================================================== =========
 
Old February 1st, 2007, 05:12 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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.
 
Old February 1st, 2007, 05:25 PM
Authorized User
 
Join Date: Feb 2007
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.
 
Old February 1st, 2007, 05:29 PM
Wrox Author
 
Join Date: Oct 2005
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^^
================================================== =========
 
Old February 1st, 2007, 05:31 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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.
 
Old February 2nd, 2007, 02:04 PM
Authorized User
 
Join Date: Feb 2007
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.
 
Old February 2nd, 2007, 02:13 PM
Wrox Author
 
Join Date: Oct 2005
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^^
================================================== =========
 
Old February 2nd, 2007, 02:27 PM
Authorized User
 
Join Date: Feb 2007
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.





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 [email protected] 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





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