Solved

Writing to second database

Posted on 2000-03-15
2
184 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now