Re: MFC MDI for binary db

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Scott McPhillips [MVP] (org-dot-mvps-at-scottmcp)
Date: 11/12/04


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]


Relevant Pages

  • Re: Limitations using Developer
    ... Chris, thanks for the response. ... > The packaging wizard is just what you use to install it. ... >> packaging wizard once to get a database to a user who didn't ...
    (microsoft.public.access.devtoolkits)
  • Re: "Hidden" Replication Stored Procedures?
    ... aforementioned MDF file in Notepad and doing a quick search, ... Is there a way to have the Resource Database appear in the list of Databases ... Chris Jones ...
    (microsoft.public.sqlserver.replication)
  • Re: Access cant open the file "image.jpg"????
    ... Chris K wrote: ... I'm not sure how developers get on with Access spending so much time ... reconnecting report backgrounds, mail merges, and tables every time ... developing the database on different machines and the image is ...
    (microsoft.public.access.reports)
  • Re: Microsoft DevDays 2004 - Smart Client 3 - Security session
    ... listening to the webcast again and I found the transcript. ... See I've gone and decrypted my database credentials, ... Thanks again Chris. ... > probably talking about using IPSEC between the app server and database ...
    (microsoft.public.sqlserver.security)
  • Re: Help me with properly create class
    ... A database exists to provide generic, ad hoc access to stored data that is independent of what particular problem the data is used to solve. ... The common way to do that is to encapsulate the DB access in a subsystem or layer that is separated from the problem solution by a interface. ... Thus objects in your problem solution, like CDocument, might not map exactly into database entities. ... That object extracts the values from the relevant attributes and encodes them in a message to the DB access subsystem. ...
    (comp.object)