Board index » delphi » Problems with cachedupdates.

Problems with cachedupdates.

Hi Everybody,

On a form I have four tables linked this way:

tbl2 linked to tbl1
tbl3 linked to tbl2
tbl4 linked to tbl2

tbl1 is shown on dbedit's and the other tables on three different dbgrids.

When I append records to the tables(one to tbl1 and several to the others),
I first set cachedUpdates to true in each table, fill in the dbedits, whose
datasource's autoedit is set to false, then fill in rows in each grid, whose
datasources' autoedits are set to true, and finally call post to tbl1. Then
I call applyUpdates to each table. tbl1 applies the updates. Then an
exception is raised and a message shown:"At end of table". CancelUpdates
works OK. Also, without CachedUpdates eveything works. Can't figure out what
is going wrong. Can anybody help, please?

Thanks,
Bolivar

PS This message has been posted before, but for some reason(probably wrong
configuration of my news reader), I lost it and any eventual answer)

 

Re:Problems with cachedupdates.


Quote
"Boia" <b...@gold.com.br> wrote:
>When I append records to the tables(one to tbl1 and several to the others),
>I first set cachedUpdates to true in each table, fill in the dbedits, whose
>datasource's autoedit is set to false,

Boia,

It sounds like you are setting cached updates to True after  opening
the table. You should set cached updates to True before opening the
table.

It's a better idea to set cached updates at design time and then leave
it alone. I've never had a problem doing it this way and I've found a
reason to change cached updates at run-time.

Phil Cain
--

Re:Problems with cachedupdates.


Hi Phillip,
Thanks for the hint. I'll try it now, and I am sure it will work.
Regards,
Bolivar

Re:Problems with cachedupdates.


Philip,
I tried setting cacheduptdates to true at design time, but I keep getting
the same error message: "At End of Table" when I try to ApplyUpdates.
Doesn't it have anything to do with records updated in a grid? The table
updated in TDBedits are accepting the ApplyUpdates with no problem.
Bolivar

Re:Problems with cachedupdates.


Quote
"Boia" <b...@gold.com.br> wrote:
>Philip,
>I tried setting cacheduptdates to true at design time, but I keep getting
>the same error message: "At End of Table" when I try to ApplyUpdates.
>Doesn't it have anything to do with records updated in a grid? The table
>updated in TDBedits are accepting the ApplyUpdates with no problem.
>Bolivar

Bolivar,

I haven't seen that and without seeing the code, it's a bit difficult,
but there are a couple of other things you need to look into.

First of all are the linked tables. Do you know which of the four
tables is giving the error message?  More importantly, are they linked
through datasources as master/detail relationships? If they are linked
that way, it could be part of your problem. There has been much talk
about problems using datasource links and cached updates. So far, I
have not done that and prefer to manage the master/detail
relationships manually.

Next is the grid itself. Do you allow deletes and inserts at the grid?
In any of the detail tables, do you use First,Next,Last or Prior in
your code to navigate them? If you do that on an empty dataset, you
can get that message.

Next, a lot depends on where you put your cached updates code. Where
does ApplyUpdates appear? Do you use OnUpdateRecord. It's not always
necessary, If you do, you might want to post that routine here. Also
post the bit where you use ApplyUpdates and CommitUpdates.

Good luck.

Phil Cain
--

Other Threads