I have an Access 97 database containing various queries. How can I execute these queries in VB under ADO? Some of the queries take parameters. Thanks in advance.
Printable View
I have an Access 97 database containing various queries. How can I execute these queries in VB under ADO? Some of the queries take parameters. Thanks in advance.
C'mon guys!! I don't believe that I'm the first person to want to do this!!
Where have all the geniuses (genii?) gone?
I believe you create a command object and execute it.
dim RecSet as adodb.recordset
dim longVal as long
cmd.CommandText="procedure"
Set RecSet= cmd.Execute(RecordsAffected:=longVal, Options:=adCmdStoredProc)
if the procedure sends *1* paramter you can use the following:
cmd.CommandText="procedure(parameter)" or
cmd.Execute(RecordsAffected:=longVal, Parameters:="parameter", Options:=adCmdStoredProc)
if it uses more you have to send an array:
cmd.Execute(RecordsAffected:=longVal, Parameters:=Array(parm1, parm2), Options:=adCmdStoredProc)