General information
Title:
Deleting from a cursoradapter
Hi!
I am using a CursorAdapter to connect to a SQL Server using ADO, and I am having some problems when deleting from a cursor that is made up of data from two related tables.
Here is an example: I have the following two tables:
testchild (id I(4), somedata C(20), foreignkey I(4))
testparent (id I(4), descr C(20))
My selectcmd looks like the following:
Select testchild.id, testchild.foreignkey, testchild.somedata,
testparent.descr
from testchild, testparent
where testparent.id = testchild.foreignkey
Now, I am trying to delete values from the child table by issuing a delete command on the cursor resulting from this select, and then calling tableupdate(). The problem is, however, that data from both parent and child table is deleted, which is not what I want. I have specified the delete-command as follows:
this.DeleteCmd = "delete from testchild where id = ?curTest.id"
I have also tried setting the tables, keyfieldlist, updatenamelist and updateablefieldlist, but the same thing happens.
Any ideas?
Thanks,
Eyvind.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only