View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John.Greenan John.Greenan is offline
external usenet poster
 
Posts: 175
Default Calling stored proc with parameters ..

You need to create a parameter object and append it. See below for an
example. For each parameter you need on parameter object. Look at the ADO
examples code for further details.



dim myParameter as adodb.parameter

set myParameter = new adodb.parameter


with myParameter
.name ="whatever the parameter name is"
.type = whatever type
end with




Comm.parameters.append myParameter


--
www.alignment-systems.com


"Harish Mohanbab" wrote:


Hi,

How to call a stored proc with parameters from Excel VBA? Without
parameters, it goes something like -

.................................................. ......
Set Comm = New ADODB.Command
Comm.ActiveConnection = Conn
With Comm
.CommandText = <STORED PROC NAME
.CommandType = adCmdStoredProc
.Execute
End With
.................................................. ......

But I am not able to call SP with multiple parameters. Can someone
help please.

Thanks in advance,

Harish Mohanbabu


--
Harish Mohanbab


------------------------------------------------------------------------
Harish Mohanbab's Profile: http://www.excelforum.com/member.php...fo&userid=6332
View this thread: http://www.excelforum.com/showthread...hreadid=468186