Discussion:
Simple Datamodule question
(too old to reply)
John Noble
2008-12-10 12:40:40 UTC
Permalink
I have set up a datamodule with one parent two children.

On my form I have 3 grids each one connected to one of the rowsets.
Everything looks as it should.

When I delete a row from the parent table, I assumed that the data held in
the child tables would also be deleted. This is not the case. Do I have to
add the code to do this myself or have I set up my datamodule wrong?

John
Ken Mayer [dBVIPS]
2008-12-10 13:41:55 UTC
Permalink
Post by John Noble
I have set up a datamodule with one parent two children.
On my form I have 3 grids each one connected to one of the rowsets.
Everything looks as it should.
When I delete a row from the parent table, I assumed that the data held in
the child tables would also be deleted. This is not the case. Do I have to
add the code to do this myself or have I set up my datamodule wrong?
Cascading deletes are not automatic, you need to add the code yourself.
In the parent rowset's canDelete event, you can add code to delete the
child data. There should be an example in my book ...

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
John Noble
2008-12-10 14:31:51 UTC
Permalink
OK,

Thanks Ken
Post by John Noble
I have set up a datamodule with one parent two children.
On my form I have 3 grids each one connected to one of the rowsets.
Everything looks as it should.
When I delete a row from the parent table, I assumed that the data held
in the child tables would also be deleted. This is not the case. Do I
have to add the code to do this myself or have I set up my datamodule
wrong?
Cascading deletes are not automatic, you need to add the code yourself. In
the parent rowset's canDelete event, you can add code to delete the child
data. There should be an example in my book ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Loading...