Re: Fields not longer available when subclassing the _RecordsetPtr cla
From: Stephen Howe (stephenPOINThoweATtns-globalPOINTcom)
Date: 01/24/05
- Next message: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Previous message: Stephen Howe: "Re: Transactions."
- In reply to: Marc G: "Fields not longer available when subclassing the _RecordsetPtr cla"
- Next in thread: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Reply: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Stephen Howe: "Re: Commit of Record insertion Access.mdb"
- Previous message: Stephen Howe: "Re: Transactions."
- In reply to: Marc G: "Fields not longer available when subclassing the _RecordsetPtr cla"
- Next in thread: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Reply: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|