I have a problem. I want to execute a stored procedure on a SQL Server from VB6 and put the result in a ADO recordset.
Here is my stored proc:
Create Procedure sp_test @SiteId int,
@SiteName char(30) OUTPUT
select @SiteName = Name from tblSites where Sitesid = @SiteId
Here is my VB6 code:
Dim ADOcmd As New ADODB.Command
Dim ADOrs As New ADODB.Recordset
.ActiveConnection = gApp.DB
.CommandText = "sp_test"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("SiteId", adInteger, adParamInput)
.Parameters.Append .CreateParameter("SiteName", adChar, adParamOutput, 30)
ADOcmd("SiteId") = 2
Set ADOrs = ADOcmd.Execute
When i want to display the number of records in the recordset "ADOrs", i have this error message:
"The operation requested by the application is not allowed if the object is closed."
Can anyone help me please ?
Thanks to all