Hi,
I am having trouble returning an ADO recordset to access from a server stored proc.
I read somewhere earlier that when select statements are perform in a stored proc they can be "automatically" returned?
This is my called procedure in access:
Function get_recordset(sqlstring As String) As ADODB.Recordset
Dim cmd As ADODB.Command
Dim criteria As ADODB.Parameter
Set cmd = New ADODB.Command
cmd.ActiveConnection = getADOConnectstring()
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "dl_data_access_get_recordset"
Set criteria = cmd.CreateParameter("criteria", adVarChar, adParamInput, 150, sqlstring)
cmd.Parameters.Append criteria
Set get_recordset = cmd.Execute
get_recordset.MoveLast
Debug.Print get_recordset.recordCount
End Function
and my stored proc is simply:
CREATE PROCEDURE dl_data_access_get_recordset
@sqlstring varchar(150) = NULL
AS
--exec(@sqlstring)
GO
I seem to be getting a recordset back from server with a recordcount of -1!
Thanks for any help
I am having trouble returning an ADO recordset to access from a server stored proc.
I read somewhere earlier that when select statements are perform in a stored proc they can be "automatically" returned?
This is my called procedure in access:
Function get_recordset(sqlstring As String) As ADODB.Recordset
Dim cmd As ADODB.Command
Dim criteria As ADODB.Parameter
Set cmd = New ADODB.Command
cmd.ActiveConnection = getADOConnectstring()
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "dl_data_access_get_recordset"
Set criteria = cmd.CreateParameter("criteria", adVarChar, adParamInput, 150, sqlstring)
cmd.Parameters.Append criteria
Set get_recordset = cmd.Execute
get_recordset.MoveLast
Debug.Print get_recordset.recordCount
End Function
and my stored proc is simply:
CREATE PROCEDURE dl_data_access_get_recordset
@sqlstring varchar(150) = NULL
AS
--exec(@sqlstring)
GO
I seem to be getting a recordset back from server with a recordcount of -1!
Thanks for any help