Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Writing to second database

Posted on 2000-03-15
2
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
abancroft earned 300 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

718 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