I created a stored procedure in SQL that outputs a record. I need
to have a function in vb exec the sp and return a recordset to use
in my program.
Stored procedure...
Function in vb to execute it.Code:IF EXISTS(SELECT Name FROM SysObjects WHERE Name = 'sp_RRGetTask' AND Type = 'P') DROP PROCEDURE sp_RRGetTask GO CREATE PROCEDURE sp_RRGetTask @Task_No nvarchar(8) OUTPUT AS SELECT * FROM Tasks WHERE Task_No = @Task_No GO
This is my code for executing stored procedures that don't return anything.VB Code:
Public Function Exec_SPrs(ByRef oCnnS As ADODB.Connection, ByVal sp_Name As String) As ADODB.Recordset '<RR 09/16/2003 - VB/OUTLOOK GURU> On Error GoTo No_Bugs Dim oCM As ADODB.Command Dim lRecs As Long Set oCM = New ADODB.Command oCM.ActiveConnection = oCnnS oCM.CommandType = adCmdStoredProc oCM.CommandText = sp_Name 'NEED TO CHANGE FROM HERE??? oCM.Execute lRecs If lRecs > 0 Then gbExec_SPrs = True Else gbExec_SPrs = False End If Exit Function No_Bugs: MsgBox Err.Number & " - " & Err.Description, vbOKOnly + vbInformation, App.ProductName End Function
How can I complete it to return an ADODB.Recordset?





Reply With Quote