Solved

Object required: '[string: "SELECT DocumentType "]'

Posted on 2003-11-24
4
795 Views
Last Modified: 2007-12-19
Greets all,

I am trying to make a DSN-Less connection (for the first time,, always used DSN until it seems to be screwing up now,,,)  So im Trying to set up a new connection.

I created an include file called "Connection.inc" with code :
Dim DATA_PATH
  Set DATA_PATH = "..."
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
  Conn.Open "DBQ=" & DATA_PATH &   ";Driver={Microsoft Access Driver (*.mdb)};

And then included this in the main file and used
Dim SQL
  Set SQL = "SELECT DocumentType FROM DocumentTypeDatabase ORDER by DocumentType"
RS.open SQL, Conn

I cant seem to access any of the information in the database and I get the error :

Microsoft VBScript runtime error '800a01a8'

Object required: '[string: "SELECT DocumentType "]'

/filetransfer/myfiles.asp, line 39

Everything worked fine with a DSN connection, So there has to be something im doing wrong with the DSN-Less Connection setup.  Could you please help?  

regards,

Ian.
0
Comment
Question by:darksinclair
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
deighc earned 50 total points
ID: 9811737
You're using the Set keyword on a non-object variable

Set SQL = "SELECT DocumentType FROM DocumentTypeDatabase ORDER by DocumentType"

Set is used for object variables only. Change it to:

SQL = "SELECT DocumentType FROM DocumentTypeDatabase ORDER by DocumentType"
0
 
LVL 15

Expert Comment

by:deighc
ID: 9811746
Same problem here:

Set DATA_PATH = "..."

Should be:

DATA_PATH = "..."
0
 
LVL 5

Author Comment

by:darksinclair
ID: 9813803
Thanks deighc, but could I ask you, Now i receive
Microsoft VBScript runtime error '800a01a8'

Object required: ''

/filetransfer/myfiles.asp, line 40

where Line 40 is :       RS.open SQL, Conn
and SQL and Conn have been changed to not be Set

Thanks, Much Appreciated!

Ian.
0
 
LVL 15

Expert Comment

by:deighc
ID: 9816534
You SHOULD use Set when creating Conn - Conn is an object variable (a connection object).
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dynamic? Dropdown Box 29 70
syntax error on ASP ? 6 40
replace quotes with UTF-8 character 38 68
Error viewing ASP page 12 97
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now