Solved

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

Posted on 2003-11-24
4
800 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 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