Re: MFC MDI for binary db
From: Scott McPhillips [MVP] (org-dot-mvps-at-scottmcp)
Date: 11/12/04
- Next message: Scott McPhillips [MVP]: "Re: how to make this grid control"
- Previous message: Ed Fultz: "Re: Context Menu Problem"
- In reply to: Chris: "MFC MDI for binary db"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Nov 2004 18:50:14 -0500
Chris wrote:
> Hi All,
> I created a MFC project as MDI.
> The main data stored in CDocument is a complex structure. This
> structure represent one record of a database (binary database).
> At present I am able to select different records from the db, one by
> one, and to display the content of each record in different views. For
> each selection, my structure, stored in CDoc, is overwrited for the
> selected record.
>
> What I would like to do is: to be able to open and display in views
> the content of 2 or more records (not only one at each time).
> I thought to 2 solutions:
> 1) To use multiple documents (of the same type) in the application ,
> each document to store the content of a separate db record (or
> pointers for CDocument).
> 2) To keep only one Doc in application, but to use an array of
> structures . Each record of the db is represented by the index of the
> array of structures.
> Which solution is the better? I think the first should be the good
> one, but I need some suggestions. Is that the way where I need to use
> GetFirstDocPosition, GetNextDoc, etc? I am not familiar with these
> methods.
> May you could help me to find some demo projects with this feature or
> some documentation.
>
> Thanks for your help.
> Chris
If all the records come from the same database then only one document is
appropriate. The document must be responsible for
opening/querying/closing the database connection. If you created
multiple documents you would have a lot of unnecessary complications
keeping track of which document was "in charge" and which views are
connected to which documents. (Each view is owned by a document, which
is responsible for creating and updating it.)
-- Scott McPhillips [VC++ MVP]
- Next message: Scott McPhillips [MVP]: "Re: how to make this grid control"
- Previous message: Ed Fultz: "Re: Context Menu Problem"
- In reply to: Chris: "MFC MDI for binary db"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|