Re: Fields not longer available when subclassing the _RecordsetPtr cla

From: Stephen Howe (stephenPOINThoweATtns-globalPOINTcom)
Date: 01/24/05


Date: Mon, 24 Jan 2005 19:11:45 -0000


> I am using VC++ with ADO using the import pragma to access a local Access
> database with multiple tables. This access works correctly using
Fields->.
> I would like to subclass _RecordsetPtr to create different classes
specific
> to each table and to add functions to them (which are different for each
> table). In DAO every recordset class corresponds to a single table, and I
> would like something similar for ADO. After subclassing, the compiler no
> longer recognizes the Fields object. Classes are created with
> class TypeOneRecordSet :: public _RecordsetPtr {
> void DoSomethingTypeOne (void); }
> class TypeTwoRecordSet :: public _RecordsetPtr {
> void DoSomethingTypeTwo (void); }
> Error reports Fields not a member of a complicated COM object.

I don't think you want to do that.
I think you should be subclassing _Recordset (and it also will be a COM
object) and then do

_COM_SMARTPTR_TYPEDEF(TypeOneRecordSet, __uuidof(_TypeOneRecordSet));

It is _COM_SMARTPTR_TYPEDEF that adds "Ptr" to the end of each ADO Com type.
It creates smart pointers from ADO objects.
So you will get TypeOneRecordSetPtr

If you are using VC++ & ADO you probably have a #import statement.
This generates a file called msado15.tlh which is a header file.
Have a search in one of the Debug/Release directories for this file.
Have a look at this and notice the relationship between

Recordset15, Recordset20, Recordset21, _Recordset

_Recordset is a Recordset21
You want to do the same. That is the easiset way of getting what you want.

Stephen Howe



Relevant Pages

  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: DAO to ADO Recordset Options
    ... DAO was really fast when dealing with Access data (faster than ADO) but was ... Recordset. ... For client-sided cursors, there is only Static cursor type regardless as ... determines how often data is fetched from the server. ...
    (microsoft.public.data.ado)