Solved

Database question (begginer)

Posted on 1999-01-06
2
147 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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

770 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