Board index » delphi » Looping through tables in database

Looping through tables in database

Hi there!

 When the user goes from one form to another, I would like to make sure that
all data is posted in all tables before the second form opens (OnActivate
event, I guess).  How do I loop through all the tables (without having to
name them) to post data if their state is in the edit or insert state???

TIA,
Pam

 

Re:Looping through tables in database


Something like this might work (untested code ahead):

    iCtr := 0;
    while (iCtr < Self.ComponentCount) do
      if Self.Components[iCtr] is TTable then
        if TTable(Self.Components[iCtr]).Modified then
          TTable(Self.Components[iCtr]).Post;

Christopher Latta

Quote
Pam <parke...@zdnetonebox.com> wrote in message news:3b326ed7_2@dnews...
>  When the user goes from one form to another, I would like to make sure
that
> all data is posted in all tables before the second form opens (OnActivate
> event, I guess).  How do I loop through all the tables (without having to
> name them) to post data if their state is in the edit or insert state???

Other Threads