Paramater for cnn.EXECUTE?

J

jason

How does one pass a parameter to the EXEC query recordset:

set rs = cnn.execute("EXEC tblListings_qry2")
 
T

Tom B

Assuming that tblListings_qry2 is a stored procedure than you would just
append it

Set RS=cnn.Execute("EXEC tblListings_qry2 5")

if there are multiple parameters, you just separate them with commas

Set RS=cnn.Execute("EXEC tblListings_qry2 5,3,'Bob''s your uncle', 99,
'hello','etc',1")
 
A

Aaron Bertrand - MVP

set rs = cnn.execute("EXEC tblListings_qry2")

Numeric:

set rs = cnn.execute("EXEC tblListings_qry2 5")
set rs = cnn.execute("EXEC tblListings_qry2 @paramName = 5")

String:

set rs = cnn.execute("EXEC tblListings_qry2 'bob'")
set rs = cnn.execute("EXEC tblListings_qry2 @paramName = 'bob'")

I'd tell you how to pass dates, but you didn't bother telling us which
database you're using...
 
J

jason

Thanks -it is a stored qry for Access.

Tom B said:
Assuming that tblListings_qry2 is a stored procedure than you would just
append it

Set RS=cnn.Execute("EXEC tblListings_qry2 5")

if there are multiple parameters, you just separate them with commas

Set RS=cnn.Execute("EXEC tblListings_qry2 5,3,'Bob''s your uncle', 99,
'hello','etc',1")
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top