Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ADO Table Relationships ( 3 Tables )

Posted on 2004-10-07
6
Medium Priority
?
600 Views
Last Modified: 2013-11-23
Hello All;

  It seems that when you are creating the MasterSource/MasterFields
Table Relationships between 3-Tables. That it will only allow you to do "2"
Tables this way.
   Is there a way to do "3" Tables?

   Reason For 3 Tables:

The Database Program that I have made to Admin my KB Web Site.
I need to have "3 Tables" Relationship together so that I can add to Master
Categories when inserting new records.

Anyway.
  Could someone please let me know how to do "3 Table Relationships in
Delphi"?

( P.S.
   Each of the Tables Fields are connected to "TDBEdits TDBMemos& TDBComboBox's"
   That I need to connect to. So when you click on a Field in the Main
Table.
   It needs to Display it's Relationship between the other Tables-Fields
   In the "TDBEdits TDBMemos& TDBComboBox's and so forth"
   And when creating new records in the Program, It needs to be able to
write
   To each of the Table-Fields the correct properties that are inserted or
chosen.)

Thank You All

Carrzkiss
0
Comment
Question by:Wayne Barron
[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
6 Comments
 
LVL 11

Expert Comment

by:calinutz
ID: 12256904
Did you try using SQL select? YOu can select even more tables together.

Something like  
select * from table1 t1, table2 t2, table3 t3 where t1.cod=t2.cod and t2.product=t3.product
or any other relationships.
0
 
LVL 4

Expert Comment

by:Greg Rowland
ID: 12259806
You can use a Query Component as a Primary/Master dataset.
Then use the Primary/Master AfterScroll event to Close then reopen Secondary/Detail  Query Component(s) with parameters.

This example happens to be using ClientDataSets, however it works just as well with TQuery.
While this is not as auto-magic as w/ TTable components, you will have more control and network conflicts are less likely.

procedure TForm1.wwClientDataSet1AfterScroll(DataSet: TDataSet);
begin
  if ((PageControl1.ActivePageIndex <> 0)
  or not (wwClientDataSet1.RecordCount > 0)) then Exit;

  try
    // Drafting Deatil Info. ---------------------------------------
    with wwClientDataSet4, Params do begin

      Close;
      ParamByName('myDrawingRecord').Value := wwClientDataSet1Record_.AsString;
      Open;

      Panel2.Caption :=
        'Record ' + IntToStr(wwClientDataSet1.RecNo) +
        ' of ' + IntToStr(wwClientDataSet1.RecordCount);

      Edit1.Text := wwClientDataSet1.FieldByName('JOB_NUM').Text;
    end;

    // Job Info ------------------------
    with wwClientDataSet5, Params do begin
      if  (wwClientDataSet1JOB_NUM.AsString <> wwClientDataSet5JOB_NUM.AsString) then begin // Job Number Has Changed
        Close;
        ParamByName('myJobNumber').Value := wwClientDataSet1JOB_NUM.AsString;
        Open;
      end;


    end;

  except

  end;

end;
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 12263682
Thanks for your replies in this.
[Surfer Joe] thanks for the code.
Maybe I am tired or something, But I could not get
It to work? Sorry. Maybe if explained a little bit of what everything
Does, then maybe.

  Anyway.
  I have made a fully functional Demo.
Please download and take a look at it.
You will have to change to "Database" path in the ADOConnection
Located in the "DataModule = Form"

READ!
  The information that needs to be read is in the "PageControl [Content Tab] = "Choose" Title = ADO Table Relationships"
Please read the " Long Description" located in the " DBMemo"
Located at the bottom of the " ScrollBox "



http://www.carrz-fox-fire.com/Delphi/Database_Relationships.zip


Thank you all
Carrzkiss
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 12343036
If no one else comes in to assist in this question,
Then I will close this question, as it has been open for
Far to lond as it is.

Thank You
Carrz
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12552296
Question answered by asker or dialog valuable.
Closed, 50 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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