|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Concurrency violation: the DeleteCommand affected 0 records vb.netHi,
I have a vb.net application accessing a SQL Server 2005 Database. It applys changes to the database using stored procedures. Updates and Inserts are working fine. Parent Table = Customers, Child Table = Orders However if I delete a record from the parent table, customers I get a concurrency error (fired when I try to update the child table). I think the reason is in SQL Server 2005 the deletes automatically cascade, but the VB application is trying to delete that customers orders as well. Anyway to stop that. I have a strongly typed dataset. Regards, Dermot Dermot,
You become not happy when you see this. This is with a WindowForms Net 2.0 dataset. \\\ Dim dt As NorthwindDataSet.Order_DetailsDataTable = _ DirectCast(NorthwindDataSet.Order_Details.GetChanges _ (DataRowState.Deleted), _ NorthwindDataSet.Order_DetailsDataTable) If Not dt Is Nothing Then Me.Order_DetailsTableAdapter.Update(dt) End If Me.OrdersTableAdapter.Update(Me.NorthwindDataSet.Orders) dt = DirectCast(NorthwindDataSet.Order_Details.GetChanges _ (DataRowState.Modified), _ NorthwindDataSet.Order_DetailsDataTable) If Not dt Is Nothing Then Me.Order_DetailsTableAdapter.Update(dt) End If dt = DirectCast(NorthwindDataSet.Order_Details.GetChanges _ (DataRowState.Added), NorthwindDataSet.Order_DetailsDataTable) If Not dt Is Nothing Then Me.Order_DetailsTableAdapter.Update(dt) End If Me.NorthwindDataSet.Order_Details.AcceptChanges() /// But I hope that it helps something, Cor Show quoteHide quote "dermot" <dfre***@tommyfrench.co.uk> schreef in bericht news:1155913636.908227.323510@m73g2000cwd.googlegroups.com... > Hi, > I have a vb.net application accessing a SQL Server 2005 Database. > It applys changes to the database using stored procedures. > > Updates and Inserts are working fine. > > Parent Table = Customers, Child Table = Orders > > However if I delete a record from the parent table, customers I get a > concurrency error (fired when I try to update the child table). I > think the reason is in SQL Server 2005 the deletes automatically > cascade, but the VB application is trying to delete that customers > orders as well. > > Anyway to stop that. I have a strongly typed dataset. > > Regards, > Dermot > Is there no way to tell the dataset, that child records are
automatically deleted by the stored proc?
VB Net and ADOX
DateTime conversion to Integer Detecting if a printer is connected to the PC Component UI CAB Architecture Guide??? For Dummies Book? :-) Redrawing a part of a control What to do when GetDeviceCaps doesn't? VB 2005 Visual Styles problem Datagrid relationships Math question: Based on excel Regex Question |
|||||||||||||||||||||||