?
Solved

[ADO] Disconnecting Recordsets executed by Command

Posted on 2003-03-02
6
Medium Priority
?
421 Views
Last Modified: 2010-04-01
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?
0
Comment
Question by:worship_me
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 152 total points
ID: 8055792
In C++ you can do

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

after that you can assin NULL to pRset

Good Luck
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 148 total points
ID: 8056580
Disconnected recordset example is here:

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

-- Dan
0
 
LVL 30

Expert Comment

by:Axter
ID: 9372424
********************************************************************************************
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 49

Expert Comment

by:DanRollins
ID: 9372557
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
 
LVL 30

Expert Comment

by:Axter
ID: 9372603
DanRollins,
Sounds good to me.
If there are no objections, I'll recommend a split.
0
 

Expert Comment

by:YensidMod
ID: 9438451
Split between roshmon and DanRollins.

Yensidmod
EE Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question