Clientdataset aggregate problem

"he00273" <[email protected]> Tue, 19 Aug 2003 03:08:10 -0000
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
I am using a simple single clientdataset connected to a dataprovider 
and dbgrid. (The dataprovider in turn is connected to a adodataset 
connected to an adoconnection connected to MS MSDE 2000 SQL server 
database)

After a delete, insert I am looping though the clientdataset to 
recalculate the number of records in the clientdataset for display 
purposes. This works ok.

I thought to do this properly I changed this behaviour by creating 
an aggregate field bound to a dbedit field.  The expression is a 
simple count(Site). (Site is the first field of the table).

When the dbgrid is first displayed, the aggregate is calculated and 
displayed ok.

When I do an insert, the dbedit bound to the field was not updated.

After an insert I, tried

 cdsSite.AggregatesActive := False;
 cdsSite.AggregatesActive := True;

The dbedit field was not updated, instead of the new displayed 
record I inserted being displayed, the record where the record point 
was, was duplicated.

I tried

cdsSite.Aggregates.Items[0].Active := False; 
cdsSite.Aggregates.Items[0].Active := True;

The same behaviour was exhibited.

It all works fine, if I handle the counting myself. When I used the 
aggregated field it got screwed up. Has anyone had similar 
experiences and can tell me what I have done wrong?



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

Delphi VCL Top Sites!
http://www.sandbrooksoftware.com/TS/TS2/Components.shtml
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/