bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
I have developed the following code to create disconnected recordsets:
My connection is opened in another subroutine and stored as oConn as shown in this route above. Is there a way to do stored procedures with multiple parameters without using the ADODB.Command object? For instance, is there some way to write out my sqlstring variable to initiate a stored procedure?
Code:
'Return a query as a recordset
Public Function SQLQueryDatabaseRecordset(SQLQuery As String) As ADODB.Recordset
'Create RecordSet
Set oRs = CreateObject("ADODB.Recordset")
oRs.LockType = adLockBatchOptimistic
Sleep 100
DoEvents
'Open Record Set by executing SQL
oRs.Open SQLQuery, oConn
'Disconnect the recordset
Set oRs.ActiveConnection = Nothing
'Return recordset
Set SQLQueryDatabaseRecordset = oRs
Set oRs = Nothing