Solved

Writing to second database

Posted on 2000-03-15
2
201 Views
Last Modified: 2010-04-02
I have an application using Dao with an Access database. I want to allow the user to "archive" old records to a separate database and view them from the "archive" file later.
The archive file needs to be user-nameable for creation when sending the current records to the archive.
I have an empty database file (named "archive.mdb") which I can copy to a new file based on the user's input. That part is working fine. The problem comes in creating CDaoRecordset- derived objects connected to that new database file.
Not looking for code here, just the framework of the approach -- how to create and connect recordsets to a user-nameable database file, etc.
0
Comment
Question by:sonora
2 Comments
 
LVL 4

Accepted Solution

by:
abancroft earned 75 total points
ID: 2620798
I'm not sure if this is what you're looking for, but to connect to a named MDB file, create a CDaoDatabase object & call the Open() method.

e.g.
CDaoDatabase dbArchive;

dbArchive.Open("C:\\TEMP\\ARCHIVE.MDB");

CDaoRecordset rsArchive(&dbArchive);
0
 
LVL 1

Expert Comment

by:Dhrubajyoti
ID: 2622280
I think you want to use a different
database.You may declare a new database
object of type CDatabase or CDaoDatabase
Open your  database using your new Accees file.
 Open record set using the second database object and write your data into the table using the recordset opened using the second database.
 
     



         
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question