Unspecified error on recordset open

Unspecified error on recordset open

Post by Greg » Thu, 04 Nov 2004 07:02:16


Hi, please help me!

I'm connecting to my database using...

Database_ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data
Source="&server.mappath("/db/db127/store.mdb")
set con=Server.CreateObject("ADODB.Connection")
con.open(Database_ConnectionString)




I'm assuming this is correct as no errors occur on these lines.
I then want to get 4 recordsets, the first two "welcome" and "featured" are
opened without a problem using the following:

Set welcome = Server.CreateObject( "ADODB.Recordset" )
welcome.ActiveConnection = con
sqlString = "SELECT * FROM welcome WHERE Key=1"
welcome.Open sqlString

Set featured = Server.CreateObject( "ADODB.Recordset" )
featured.ActiveConnection = con
sqlString = "SELECT * FROM featured Order By Key"
featured.Open sqlString




However, the next two recordsets "topten" and "cat" I use the following code
for, but they give me an unspecified error number 80004005 on the line that
opens them... whatever.Open sqlString. The format of this code is exactly
the same as the previous, so why won't it work?

Set topten = Server.CreateObject( "ADODB.Recordset" )
topten.ActiveConnection = con
sqlString = "SELECT * FROM topten Order By Position"
topten.Open sqlString

Set cat = Server.CreateObject( "ADODB.Recordset" )
cat.ActiveConnection = con
sqlString = "SELECT * FROM categories Where SubCatOf = 0 Order By Position"
cat.Open sqlString




The database tables are as follows:
topten("Position" - primary key, numeric
"Code" - text
"Text" - text)
categories("CatNo" - primary key, text
"CatName" - text
"SubCatOf" - numeric
"Position" - text)
welcome("Key" - primary key, numeric
"Picture" - text
"Title" - text
"Message" - memo)
featured("Key" - primary key, numeric
"Title" - text
"Pic" - text
"Text" - memo)



I just can't understand why some of it works and the rest doesn't?! Any help
would be much appreciated, many thanks,
Greg.
 
 
 

Unspecified error on recordset open

Post by Sue Hoegem » Sat, 06 Nov 2004 11:18:59

This doesn't really have anything to do with SQL Server so
you probably want to post this to an Access or ASP
newsgroup.

-Sue

On Tue, 2 Nov 2004 22:02:16 -0000, "Greg"