Without seeing the code it's very hard to comment. One thing worth checking
though is how you are 'deleteing' rows in the cached datatable. You should
be calling Datarow.delete on the row in question. This will flag the row as
deleted enabled the dataadapter to detect which rows have been deleted and
run the appropriate database delete command.
In order for the data adapter to delete though you will also need to have
some mapping going on between the datarow's original primary key and the
table's primary key in the database. Do you have this in place as well ?
Regards
--
--------------------------------------------------------
Peter Wright (
www.petewright.org)
Author of ADO.NET Novice To Pro
From Apress.
www.apress.com
"Ori Anavim via .NET 247" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> Hi,
>
> I have a listbox which is bounded to a datatable. I allow the users to
add/remove items from the list while adding/remove rows from the datatable
which function as the datasource.
>
> When I come to do the ?update? back to the datatbase using the
SqlDataAdapter and the insert/delete command, I see that only the new rows
are added and the old one doesn?t. removed from the database.
>
> After a short investigation, I notice that if I remove the rows directly
from the datatable the deletecommand doesn?t have a row to operate on.
>
> Can someone explain me exactly how to use the delete command along with a
binding to a listbox which you can remove and add items.
>
> Thanks,
>
> Ori.
>
>
> --------------------------------
> From: Ori Anavim
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>6Z0phwcpukajpwngCx+Jyw==</Id>