Create a RecordSet within a RecordSet in VC++ ?? 
Author Message
 Create a RecordSet within a RecordSet in VC++ ??


I'm having problems creating a recordset within a recordset in VC.
Here's what I do:

#import "msado15.dll" rename("EOF", "adoEOF")

ADODB::_RecordsetPtr rs = NULL;
ADODB::_RecordsetPtr rsItem2 = NULL;
ADODB::FieldPtr fld = NULL;
ADODB::_RecordsetPtr rsDummy = NULL;

rs->Fields->Append(L"Item1", (ADODB::DataTypeEnum)adBSTR, adBSTR,
rs->Fields->Append(L"Item2", (ADODB::DataTypeEnum)adVariant, adVariant,
rs->Open(L"", vtMissing, (ADODB::CursorTypeEnum)adOpenUnspecified,
(ADODB::LockTypeEnum)adLockUnspecified, adCmdUnspecified);

rs->Fields->Item["Item1]->Value = _com_util::ConvertStringToBSTR("Some value
for Item1");

// Create a new recordset for item 2
rsDummy->Fields->Append(L"Item2Array", (ADODB::DataTypeEnum)adBSTR, adBSTR,
rsDummy->Open(L"", vtMissing, (ADODB::CursorTypeEnum)adOpenUnspecified,
(ADODB::LockTypeEnum)adLockUnspecified, adCmdUnspecified);

rs->Fields->Item["Item2"]->Value = (_variant_t)rsDummy;

fld = rs->Fields->Item["Item2"];
rsItem2 = fld->Value;

rsItem2->Fields->Item["Item2Array]->Value =
_com_util::ConvertStringToBSTR("Some value for Item2");

It goes wrong at line 'rsItem2 = fld->Value;', the following error is given
'The object invoked has disconnected from its clients.'.
When I do all of this in VB, it goes OK.

Hope that anyone has an idea how I can solve this.



Tue, 14 Aug 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Create and append an ADO Recordset in VC++

2. Creating a ADO recordset from VC

3. Creating a recordset by hand in VC++

4. Requerying recordset blanks out toolbar recordset buttons

5. Access violation in Recordset.Open() and Recordset.RecordCount

6. Problem with ADO recordsets of recordsets under MTS

7. Requerying recordset blanks out toolbar recordset buttons

8. working with recordsets in vc++

9. vc++ and recordsets

10. Implementing Find Feature in DAO vc++ 5.0 recordset application

11. Creating an MTS Comp that returns Recordset

12. Dynamically create a recordset with an SQL Statement


Powered by phpBB® Forum Software