?
Solved

Two Database Connections

Posted on 1999-07-27
2
Medium Priority
?
181 Views
Last Modified: 2013-11-20
I Have a question regarding Whether i can open Two databases using CDatabase at the Same time. I have the following problem. I have to read records from one Database And then transfer those records to a different Database. I would like to know whether this is possible in any way without closing the recordsets or the databases and opening the other connection.

I would also like to know whether i can Create a Database dynamically creating also a table Dynamically.

Thanks in Advance
Karthik
0
Comment
Question by:karthikr
2 Comments
 
LVL 1

Accepted Solution

by:
Liu earned 20 total points
ID: 1311707
Yes, there is no problem opening two databases.  Just use two CDatabase instances.  

Creating table dynamically is easy.  Execute a "create table ... " sql statement using CDatabase::ExecuteSQL.  

You may into trouble if you don't have the privilege to create tables (You didn't say what kind of database you are using, Access, Oracle, or Sybase?).

I don't think you can create database dynamically using MFC ODBC classes.  If you are using Access, you may be able to do it using MFC DAO classes.
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1311708
supposing the two table have same structure.
bind proper var to each record.
for each record
{
   pRec1->Move
   copy var value from rec1 to rec2
   pRec2->Add
   pRec2->Update
}

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

589 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