[ADO] Disconnecting Recordsets executed by Command

How do you disconnect recordsets that were opened this way in ADO...

C++

_CommandPtr pCommand;
pCommand.CreateInstance(----);
pCommand->ActiveCommand = pConn;
....
_RecordsetPtr pRset;
pRset.CreateInstance(----);
pRset->CursorLocation = adUseClient;
pRset->Open(_variant_t((IDispatch*)pCommand),
           vtMissing, adOpenStatic,
           adLockBatchOptimistic, adCmdUnspecified);

VB

Dim command AS ADODB.Command
Dim recordset AS ADODB.Recordset

Set command = New ADODB.Command
command.ActiveConnection = conn
...
Set recordset = New ADODB.Recordset
recordset.open command,,adOpenStatic,
              adLockBatchOptimistic, adCmdUnspecified

How to set the ActiveConnection property of pRset to NULL or nothing. Do I use the command object that I opened it with?
worship_meAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Roshan DavisConnect With a Mentor Commented:
In C++ you can do

     pRset->PutSort(_T(""));
     pRset->Close();    

after that you can assin NULL to pRset

Good Luck
0
 
DanRollinsConnect With a Mentor Commented:
Disconnected recordset example is here:

   http://support.microsoft.com/default.aspx?scid=kb;EN-US;184397

-- Dan
0
 
AxterCommented:
********************************************************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept [roshmon ]'s comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Axter
EE Cleanup Volunteer
********************************************************************************************
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
DanRollinsCommented:
I'm not so sure... does does changing the Sort disconnect the recordset?  THe link I provided showed how to use  
    PutRefActiveConnection(NULL);
which seems to be on target.  Assuming that PutSort also works, I'd recommend a split.

-- Dan
0
 
AxterCommented:
DanRollins,
Sounds good to me.
If there are no objections, I'll recommend a split.
0
 
YensidModCommented:
Split between roshmon and DanRollins.

Yensidmod
EE Moderator
0
All Courses

From novice to tech pro — start learning today.