| | |
Deleting rows in datagrid
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2008
Posts: 31
Reputation:
Solved Threads: 0
Update requires a valid DeleteCommand when passed DataRow collection with deleted rows. This is the error I get when I'm deleting a row in my datagrid. I referred my code to a running program but when I embedded it on my own it occured that way. Here's the code:
myConn.Open();
dTable = new DataTable("Records");
dTable = this.ds.Tables[0];
int i = this.iRowIndex;
dTable.Rows[i].Delete();
this.da.Update(dTable);Any suggestions?
•
•
Join Date: Jan 2006
Posts: 22
Reputation:
Solved Threads: 4
Before calling the update() method of the data Adapter call the acceptchanges of the datatable
type dTable.AcceptChanges(); i.e
hope this help.
type dTable.AcceptChanges(); i.e
C# Syntax (Toggle Plain Text)
myConn.Open(); dTable = new DataTable("Records"); dTable = this.ds.Tables[0]; int i = this.iRowIndex; dTable.Rows[i].Delete(); dTable.AcceptChanges(); this.da.Update(dTable);
Last edited by Tekmaven; Jul 14th, 2008 at 11:04 pm. Reason: Added code tags
![]() |
Similar Threads
- How to delete a particular row from a datagrid..? (VB.NET)
- Deleting a Row From A DataGrid (VB.NET)
- Use of DataGrid (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: Lookin for Multiple sort listbox
- Next Thread: zlib decompress
Views: 4130 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access algorithm array barchart bitmap box button buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagridview dataset datetime degrees draganddrop drawing encryption enum excel file files form format forms ftp function gcd gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





