Board index » delphi » Master/Detail table relationship with TADOQuery?

Master/Detail table relationship with TADOQuery?

Hi..

Can I set up two TADOQuery tables to be in MASTER/DETAIL relationship?

I have two tables in a SQL Server db, one with customers and one with
transactions. I'm trying to set the SQL in the first query based on which
location the user is view customers from, and then have the second query
just pull records for the customer selected via the first query.

The reason I'm looking for a way to sort of automatically join the two
queries is that I want to iterate through all the customers in the first
table and show their orders from the second table, all via an HTML page
using webSnap with Delphi 6..

Any ideas?

Thanks,

Rich

 

Re:Master/Detail table relationship with TADOQuery?


"Richard Morey" <rwmore...@hotmail.com> schrieb im Newsbeitrag
news:3e206c6a$1@newsgroups.borland.com...
Quote
> Hi..

> Can I set up two TADOQuery tables to be in MASTER/DETAIL relationship?

> I have two tables in a SQL Server db, one with customers and one with
> transactions. I'm trying to set the SQL in the first query based on which
> location the user is view customers from, and then have the second query
> just pull records for the customer selected via the first query.

> The reason I'm looking for a way to sort of automatically join the two
> queries is that I want to iterate through all the customers in the first
> table and show their orders from the second table, all via an HTML page
> using webSnap with Delphi 6..

> Any ideas?

Same way as you would do it with TQuery ! ;-)

BTW: Please do not crosspost, as your question is no direct WebSnap problem
!

Levend.

Re:Master/Detail table relationship with TADOQuery?


Quote
>Can I set up two TADOQuery tables to be in MASTER/DETAIL relationship?

Yes although I recommend you use a TadoDataset instead of a TadoQuery.

for the TadoDataset the sql goes in the command text for TadoQuery use the SQL
property.  
If you set the datasource property to point to the master dataset any parameters
used in your SQL that have the same name as fields in your master dataset will
get their parameter values from the master dataset and the detail query will
re-execute when the master record changes.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads