S
stjulian
If inside a stored procedure, there a SELECT statement to return a recordset
and another SELECT to set the value of an output parameter (as in SELECT
@OutValue = Name FROM table WHERE pkid=5), would 2 execute statements be
needed to return the OUTPUT parameter?
Like this?
adocmd.CommandTimeout = 120
adocmd.ActiveConnection = conn
adocmd.CommandType = adCmdStoredProc
adocmd.CommandText = "dbo.sprMyProcedure"
' write to database using spr
With adocmd
set param = .CreateParameter("@Value1", adInteger, adParamInput, 4, 15)
.parameters.append param
set param = .CreateParameter("@Value2", adInteger, adParamInput, 4, 19)
.parameters.append param
set param = .createparameter("@OutValue", adVarChar, adParamOutput, 50)
.parameters.append param
set rs = .execute
.execute
MyValue = .Parameters("@OutValue").Value
And, for that matter, how would I open the recordset so that it may be
restarted with
rs.MoveFirst
without getting
error '80040e18'
Rowset position cannot be restarted.
and, as well be able to retrieve the number of rows with rs.Recordcount ?
and another SELECT to set the value of an output parameter (as in SELECT
@OutValue = Name FROM table WHERE pkid=5), would 2 execute statements be
needed to return the OUTPUT parameter?
Like this?
adocmd.CommandTimeout = 120
adocmd.ActiveConnection = conn
adocmd.CommandType = adCmdStoredProc
adocmd.CommandText = "dbo.sprMyProcedure"
' write to database using spr
With adocmd
set param = .CreateParameter("@Value1", adInteger, adParamInput, 4, 15)
.parameters.append param
set param = .CreateParameter("@Value2", adInteger, adParamInput, 4, 19)
.parameters.append param
set param = .createparameter("@OutValue", adVarChar, adParamOutput, 50)
.parameters.append param
set rs = .execute
.execute
MyValue = .Parameters("@OutValue").Value
And, for that matter, how would I open the recordset so that it may be
restarted with
rs.MoveFirst
without getting
error '80040e18'
Rowset position cannot be restarted.
and, as well be able to retrieve the number of rows with rs.Recordcount ?