🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database.dotnet
Article #119

listbox problem

#119
From: Brigitte Spatz
Date: Tue, 19 Sep 2006 07:42
34 lines
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
Technical Details
Message-ID: <450f9f6a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,5bb674ee425aa4ae,start
X-Google-Attributes: gid1effe6,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 19 Sep 2006 09:42:21 +0200
From: Brigitte Spatz <brigitteNOSPAM.spatz@svenmahn.de>
Organization: Sven Mahn IT-Systementwicklungen
User-Agent: Thunderbird 1.5.0.7 (Windows/20060909)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.database.dotnet
Subject: listbox problem
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 0637-2, 15/09/2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 217.189.155.16
Message-ID: <450f9f6a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158651754 217.189.155.16 (19 Sep 2006 00:42:34 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail