Stored Proc - quickest recordset?

J

jason

What is the simplest way to open up a stored query in Access - I'v got this
far but I need to open: qry_Listings


set cnn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/listings.mdb") '//This one is for Access
2000/2002
cnn.Open strCon
 
J

jason

Thanks - but throws up an error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'Provider=Microsoft.J'
/catamaranco/listings/index.asp, line 8
set cnn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/listings.mdb") '//This one is for Access
2000/2002
set rs = strCon.execute("EXEC qry_Listings")
 
A

Aaron Bertrand - MVP

set rs = strCon.execute("EXEC qry_Listings")

Sorry, should be cnn.execute (and it should come *AFTER* cnn.Open strConn).

To avoid confusion, you might use a standard name for the object, and not
bother putting the string into a variable (you don't gain much from that
anyway, since it's only used once).

set conn = createobject("ADODB.Connection")
conn.open "Provider= ..."
set rs = conn.execute("EXEC qry_Listings")
....
 
B

Bob Barrows

jason said:
What is the simplest way to open up a stored query in Access - I'v
got this far but I need to open: qry_Listings


set cnn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../database/listings.mdb") '//This one is for Access
2000/2002
cnn.Open strCon

This works as well:

set rs=server.createobject("adodb.recordset")
cnn.qry_Listings rs
 
J

jason

Thanks.

Aaron Bertrand - MVP said:
Sorry, should be cnn.execute (and it should come *AFTER* cnn.Open strConn).

To avoid confusion, you might use a standard name for the object, and not
bother putting the string into a variable (you don't gain much from that
anyway, since it's only used once).

set conn = createobject("ADODB.Connection")
conn.open "Provider= ..."
set rs = conn.execute("EXEC qry_Listings")
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top