Solved

Database question (begginer)

Posted on 1999-01-06
2
145 Views
Last Modified: 2010-04-04
I have delphi 3.0 and i need to know which components do I need to use to compare two databases *.dbf .I need to compare two fields from different databases.
0
Comment
Question by:Dark_Man
2 Comments
 
LVL 1

Accepted Solution

by:
Oli2 earned 50 total points
ID: 1355009
Just use two TTables.

var: nmatch : Integer;
while ( not Table1.EOF ) or ( Table2.EOF ) do
begin
if Table1.Fields[3].AsString = Table2.Fields[9].AsString then inc ( nmatch );
Table1.Next;
Table2.Next;
end;

This would compare the 3rd Field of Table1 with the 9th Field of Table2.
It would compare it record for record tough.

Is that what you needed ?

Greetings, Oli
0
 
LVL 1

Expert Comment

by:martin_g
ID: 1355010
You need to first have two table components (and two datasource components attached to those tables if you are going to display the information).

For example:
Table1 with DataSource 1
Table2 with DataSource 2

Now for some code:

Table1.Open;  {activate the table and go to the first field}
Table2.Open;
if Table1FIELDTOCOMPARE.Value = Table2.FIELDTOCOMPARE.Value then
  do something; {this compares the values of the fields "FIELDTOCOMPARE" in the first record of TAble 1 and Table2}

If you need to find a value (such as a lookup table or need to loop through a table, let me know and I'll show you how).

Hope this will get you started.



0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

12 Experts available now in Live!

Get 1:1 Help Now