2006. november 8., szerda

How to set all tables linked to a TDatabase back to active


Problem/Question/Abstract:

Is there a way to set all tables linked to a particular TDatabase component back to active automatically?

Answer:

Not totally automatic but with just two lines of code. If you want certain tables that share DB1 to keep closed (shadow tables etc, only opened for special routines) use the Tag of the DataSets to determine which ones to open.

for i := 0 to pred(DB1.DataSetCount) do
  {if DataSets.Tag = 1 then}
  DataSets[i].Open;

Nincsenek megjegyzések:

Megjegyzés küldése