Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disconnect an ADO recordset created from a command?

Status
Not open for further replies.

entaroadun

Programmer
Sep 27, 2002
583
US
I want to execute a stored procedure using the ADO command object and get a disconnected recordset. How can I do this?

I don't want to build a SQL string which calls the stored procedure, because I have to be able to retrieve the output values of the parameters. It has to be a command object so I can populate the parameters collection.

I tried opening a recordset off of the command object, but after I do this, I cannot set the ActiveConnection property of the recordset to Nothing (throws an error), and if I set the ActiveConnection property of the command to nothing, the recordset closes on me.

Help!
 
I have done it this way before

sSQL = "Select * From Periods"
m_hDB.Mode = adModeRead
m_hDB.Open

With m_rs
If .State Then .Close
.CursorLocation = adUseClient
.Open sSQL, m_hDB, adOpenStatic, adLockReadOnly
End With

Set m_rs.ActiveConnection = Nothing
m_hDB.Close

Is that what you are looking to do? If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
Foada,

Your example uses a SQL Select that is passed to the recordset's Open method. This works fine, and always works, for me. It is trying to disconnect a recordset returned from using a stored procedure (with CommandType equal to adCmdStoredProc) which causes me to get error #3707.

Does anyone know how do go about doing this? It should be possible.

Doctor Who
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top