Ok, so what is wrong with this?
Dim strsql as string
strsql = "Exec [up_UniverNums]' " & (e-mail address removed)" '
"
:
Build an EXEC string to call your SP with the parameters; something
like:
sqlString "EXEC MySP 1234, 5678, 'MyName', ...
or use the Command object and add your parameters to the Parameters
collection. There have been numerous examples on how to use the
Command
object: search for "Parameters" with Google on this newsgroup. You
can
either add the parameters explicitely or use the Refresh command:
Dim cmd as ADODB.Command
Set cmd = new ADODB.Command
Set cmd.Connection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "NameOfYourStoredProcedure"
Dim p As ADODB.Parameter
cmd.Parameters.Refresh
For Each p In cmd.Parameters
Debug.Print "name = " & p.name
Debug.Print "Direction = " & p.Direction
Debug.Print "Type = " & p.Type
Debug.Print "Size = " & p.Size
Debug.Print "Precision = " & p.Precision
Debug.Print "NumericScale = " & p.NumericScale
Debug.Print
Next
The file adovbs.inc (there is also a version for javascript) that you
will
find on your machine contains the values for the Type but here's a
transcript:
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=122
You can also use a typelib instead:
http://www.asp101.com/articles/john/typelibs/default.asp
Don't forget that the name of the parameters is not important but that
their
*order* is. Also, if you have a return value in your SP then you must
add a
parameter of
type adParamReturnValue and it must be the first of the list
(*important*).
Finally, you can take a look at the m.p.data.ado newsgroup.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
I have a form with buttons on it that I would like to open a stored
procedure
with, easy enough, however I want to pass a parameter to the stored
procedure. The parameter is a value from a text box on the form.
How/can
this be done?