Autor Beitrag
colaka
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: So 07.09.08 21:19 
Hallo,

ich habe 2 Paradox-Tabellen TAuto.db und TBilder.db, die ich beide in jeweils einem DBGrid darstelle. Jedes Bild gehört natürlich nur zu einem ganz bestimmten Auto, aber die einzelnen Autos können mehrere Bilder haben. Nun möchte ich, daß beim Durchblättern der Autos im anderen DBGrid nur die Bilder angezeigt werden, die auch zu dem betreffenden Auto gehören. Deshalb habe ich das DBGrid, das die Bilder enthält, mit einer Query verbunden, deren SQL-String so aussieht:
SELECT * FROM TAuto, TBilder
WHERE TBilder.AutoNr = TAuto.Nr
Doch ich kann in beiden DBGrids blättern, wie ich will, es werden mir immer sämtliche Autos und sämtliche Bilder angezeigt.

Irgendetwas mache ich da wohl falsch?

Danke Ebi
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 07.09.08 21:25 
Dann brauchst du 2 Abfragen (eine Master und eine Detail-Abfrage; .MasterSource)

_________________
Markus Kinzler.
colaka Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: So 07.09.08 21:32 
Danke für Deine schnelle Antwort, aber ich kann damit leider nicht viel anfangen. Könntest Du das vielleicht etwas genauer erklären?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 07.09.08 21:39 
Abfrage 1: Select <Feldliste 1> from Auto;
Abfrage 2; Select <Feldliste 2> from Bilder where AutoNr := :AutoNr;
Dann die
ausblenden Delphi-Quelltext
1:
2:
dsAuto.DataSet = qAuto; 
qBilder.MasterSource = dsAuto;

_________________
Markus Kinzler.