Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Two Database Connections

Posted on 1999-07-27
2
Medium Priority
?
176 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
[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 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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

721 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