Solved

Joining the data from two databases

Posted on 2002-05-09
5
125 Views
Last Modified: 2010-04-04
Hi guys,

How would I join the data from two databases?  I have to connect to a FoxPro Database and an Access database, perform a query in each, and then display the results from both queries in a single DBGrid.  Any ideas on the best way to do this.  I am offering alot of points as this is an urgent problem that I need fixing.  I am using Delphi 6.

Cheers
0
Comment
Question by:gtbikeuk
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6999243
with bde,
use two tdatabases or provide as databasename the two different aliases

with ado,
use two adoconnections
0
 
LVL 3

Accepted Solution

by:
marcoszorrilla earned 400 total points
ID: 6999258
With Access:
1º.- Create a Compatible table with both (Access and Fox Tables).

2º.- Create a query that delete all the records .

3º.- Create a query that Add all the rows from Access table to the New Access Table.

4º.- Create an other query tha do the same with the Fox Table, (the fox Table must be linked via Access).

Now you connect via ADO with Access and execute this StoreProcedures.

Link the resulting Table via AdoTable and a Dataset, and  link the Dbgrid with this Dataset.

Bye.
0
 
LVL 6

Expert Comment

by:swift99
ID: 6999891
Link the Foxpro tables into the Access database, then run your query against the Access database.  The DAO provides the transparency layer that performs the join, and is reasonably fast about it.  I have used this technique with Access in a pinch to resolve cross database issues in multi-terabyte mainframe databases.

In Access
* use Insert | Table ... Link Table,
* select "FoxPro" in the "Files of Type" entry
* Select the tables you want to link

From this point on the Foxpro tables will be transparently available to any application in any platform that talks to the Access database.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 7000486
The Swift99 answer is the correct answer, barring any unforseen problems.  

Make sure your FoxPro table is properly indexed and your Access table has an index on the joined column(s).
0
 
LVL 45

Expert Comment

by:aikimark
ID: 7088377
gtbikeuk,

Why did you select the more complicated, slower, and troublesome solution?
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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