Thread View: borland.public.delphi.database.dotnet
1 messages
1 total messages
Started by Brigitte Spatz
Tue, 19 Sep 2006 07:42
listbox problem
Author: Brigitte Spatz
Date: Tue, 19 Sep 2006 07:42
Date: Tue, 19 Sep 2006 07:42
34 lines
2361 bytes
2361 bytes
I have a databound listbox. It gets its data from a dataview with a
rowfilter. There's a button that adds entries to the listbox, which is
working fine. There's another button that's supposed to remove entries
from the listbox, however, it doesn't work as it's supposed to. I can
remove exactly one entry but on the second one it tries to delete the
same record from the database again, which obviously isn't present any
more. Here's what I do:
strID := libDocuments.SelectedValue.ToString; //libDocuments is the
listbox
messagebox.Show(strID); //this is how I know it tries to delete the
wrong entry
libDocuments.DataBindings.Clear;
dv_doc.AllowDelete := True; //the dataview
bm_doc.RemoveAt(libDocuments.SelectedIndex); //binding manager base
db.write_changes(da_doc, ds, false, 'Dokumente'); //this is
basically a sqldataadapter.update just with some associated logging but
I've alternatively also tried it with an explicit SQL delete statement
as follows:
// sc := sqlcommand.Create('delete from tbl_Documents where
fld_documentID = '
// + strID);
// da_doc.DeleteCommand := sc;
// db.write_changes_del(da_doc, ds, true, 'Dokumente', sc);
dv_doc.AllowDelete := False;
SetLookupBinding(libDocuments, 'fld_documentAddress',
'fld_documentID',
'fld_documentID', dv_doc, dv_doc);
Where am I going wrong?
TIA.
Brigitte
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads