[AccessD] Executing Stored Procedures in a A2K ADP?

Brett Barabash BBarabash at TappeConstruction.com
Fri May 7 08:56:34 CDT 2004


One of the coolest features about ADO is that you can call stored procedures
just like built-in methods:

With CurrentProject.Connection
    .sp_DeleteRAs RANum
End With

If you want to open up a recordset based off of a stored procedure, you can
do the following:

Dim rs As Recordset
Set rs = New Recordset

With CurrentProject.Connection
    .sp_GetCustomerList MyAcctNo, rs
End With

-----Original Message-----
From: Mackin, Christopher [mailto:CMackin at quiznos.com]
Sent: Friday, May 07, 2004 8:47 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Executing Stored Procedures in a A2K ADP?


There are other ways, in my opinion this is the best though, except for the
breaking out of the creation of the paramter and asigning it in another
line, you can set the value of the paramter when you create it.

.Parameters.Append .CreateParameter("@RANum", adVarChar, adParamInput, 25,
RANum)

-Chris Mackin

-----Original Message-----
From: Joe Rojas [mailto:JRojas at tnco-inc.com]
Sent: Friday, May 07, 2004 7:11 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Executing Stored Procedures in a A2K ADP?


Hi All,

I am working on an A2k ADP with a SS7 BE.

When executing stored procedures, both with and without parameters, I create
and ADO Command object to do this.
For example,

Set com = New ADODB.Command
With com
.ActiveConnection = CurrentProject.Connection
          .CommandText = "dbo.sp_DeleteRAs"
          .CommandType = adCmdStoredProc
          .Parameters.Append .CreateParameter("@RANum", adVarChar,
adParamInput, 25)
          .Parameters("@RANum") = RANum
          .Execute
End With

Does A2K, when working with ADPs, have a more direct/better way of executing
stored procedures from code or this the only/best way to do this?

Thanks,
JR


--------------------------------------------------------------------------------------------------------------------
The information in this email may contain confidential information that 
is legally privileged. The information is only for the use of the intended 
recipient(s) named above. If you are not the intended recipient(s), you 
are hereby notified that any disclosure, copying, distribution, or the taking 
of any action in regard to the content of this email is strictly prohibited.  If 
transmission is incorrect, unclear, or incomplete, please notify the sender 
immediately. The authorized recipient(s) of this information is/are prohibited 
from disclosing this information to any other party and is/are required to 
destroy the information after its stated need has been fulfilled.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Tappe Construction Co.

This footer also confirms that this email message has been scanned
for the presence of computer viruses.Scanning of this message and
addition of this footer is performed by SurfControl E-mail Filter software
in conjunction with virus detection software.




More information about the AccessD mailing list