1. cannot get rs from stored procedure to release user connection without closing rs
I'm having trouble creating a recordset where the SQL Server 7 'user
connection' is freed after opening the recordset. I'm using VB6 MDAC
2.6 on NT4 SP6a with SQL7 SP3
I am able to use an SQL statement to return a disconnected recordset
where the 'user connection' is freed when I close the connection
object without any problems.
But for my code that uses a stored procedure instead of an SQL
statement (show below) runs, the 'user connection' (as show in the
Performance Monitor of SQL Server viewing the User Connections) only
gets released when the recordset is closed, not when the connection is
closed when disconnecting the recordset.
I am at a loss as I've looked at code examples documenting
disconnected recordset with stored procedures - and I seem to be on
target. The code is very much the same as for the SQL statement
version.
Help????
Function RunSPReturnRS(ByVal spName$, params As Variant) As
ADODB.Recordset
Dim rs As ADODB.Recordset, cmd As ADODB.Command
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
Dim cnn As ADODB.Connection
Set cnn = GetConn
cmd.ActiveConnection = cnn
cmd.CommandText = spName$
cmd.CommandType = adCmdStoredProc
collectParams cmd, params
rs.CursorLocation = adUseClient
rs.cursorType = adOpenKeyset
rs.locktype = adLockBatchOptimistic
rs.Open cmd
Set rs.ActiveConnection = Nothing
Set RunSPReturnRS = rs ' return the rs as the functions value
Set cmd = Nothing
cnn.Close ' user connection SHOULD be release here, is not
Set cnn = Nothing
Set rs = Nothing
END Function
MAIN CODE HERE
Dim rs As ADODB.Recordset, retSqlErr As retSqlErrs
Set rs = RunSPReturnRS("prGetSysIdFromLineNum",
' do something here
rs.Close ' user connnection IS released here????
' WHY is connection only release when close rs???
Set rs = Nothing
--
2. Urgent - Update in a table being raplicated (Bug????)
3. rs.close and set rs = nothing
4. Problem with ORA Lite ODBC via MS-ACCESS
5. Set rs = nothing and rs.Close
6. Error 161 - Maximum licenses reached
7. cannot get rs from stored procedure to release user connection without closing rs
8. SQL Question in FPW 2.5
9. Closing an ADO db & rs
10. Rs.Open vs. Set Rs = Conn.Execute
11. Bounding Datalist with Rs via Open or Rs via cmd.execute
12. rs.open vs. set rs = conn.execute
13. ADO, rs.AddNew, rs.Update, rs.Filter, rs.EditMode