views:

124

answers:

4

Hi there!

I'm designing database app with ZeosLib. On one form I have some Lookups that should refer to the same dataset. Is it safe to create one TDataSet descendant and then connect few TDataSources to it ?

A: 

I think with lookuptables it should be save, since it doesn't really matter where in the dataset the cursor is positioned. I'd say: give it a try!

birger
A: 

It is safe but why not just have one TDataSource connected to the one TDataSet? They'll all do the same thing.

_J_
A: 

Thanks for your answers.

One more question: Is it a good programming practice to have such layout :

TDataSet (lookup items TZQuery) (fields ID,A,B)
                 |
                 +----> TDataSource ------> Lookup compo listing field A and returning ID
                 |
                 +----> TDataSource ------> Lookup compo listing field B and returning ID
                 |
                 ...

What about lookups in TDBCtrlGrid ? I know that Delphi explicitly disables this opportunity, but my research proves that this is possible. I've created csReplicatable descendant of TCustomComboBox with TDataFieldLink and one DataSource as Listsource, and actually it works ok, so I don't understand such limitation. Where it comes from ?

Gobol
+1  A: 

It is not only possible but advisable to use one dataset for all datasources which display the same information. The dataset keeps the data and the datasources keeps the positioning information (cursor) required by data aware components.

Tihauan