Wayne Barron
asked on
ADO Table Relationships ( 3 Tables )
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
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
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.wwClientDataSet1Aft erScroll(D ataSet: TDataSet);
begin
if ((PageControl1.ActivePageI ndex <> 0)
or not (wwClientDataSet1.RecordCo unt > 0)) then Exit;
try
// Drafting Deatil Info. -------------------------- ---------- ---
with wwClientDataSet4, Params do begin
Close;
ParamByName('myDrawingReco rd').Value := wwClientDataSet1Record_.As String;
Open;
Panel2.Caption :=
'Record ' + IntToStr(wwClientDataSet1. RecNo) +
' of ' + IntToStr(wwClientDataSet1. RecordCoun t);
Edit1.Text := wwClientDataSet1.FieldByNa me('JOB_NU M').Text;
end;
// Job Info ------------------------
with wwClientDataSet5, Params do begin
if (wwClientDataSet1JOB_NUM.A sString <> wwClientDataSet5JOB_NUM.As String) then begin // Job Number Has Changed
Close;
ParamByName('myJobNumber') .Value := wwClientDataSet1JOB_NUM.As String;
Open;
end;
end;
except
end;
end;
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.wwClientDataSet1Aft
begin
if ((PageControl1.ActivePageI
or not (wwClientDataSet1.RecordCo
try
// Drafting Deatil Info. --------------------------
with wwClientDataSet4, Params do begin
Close;
ParamByName('myDrawingReco
Open;
Panel2.Caption :=
'Record ' + IntToStr(wwClientDataSet1.
' of ' + IntToStr(wwClientDataSet1.
Edit1.Text := wwClientDataSet1.FieldByNa
end;
// Job Info ------------------------
with wwClientDataSet5, Params do begin
if (wwClientDataSet1JOB_NUM.A
Close;
ParamByName('myJobNumber')
Open;
end;
end;
except
end;
end;
ASKER
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
[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
ASKER
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
Then I will close this question, as it has been open for
Far to lond as it is.
Thank You
Carrz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Something like
select * from table1 t1, table2 t2, table3 t3 where t1.cod=t2.cod and t2.product=t3.product
or any other relationships.