Hello guys i`m trying to delete a row in a access database but when i try to update the dataset it give me this error
Update requires a valid DeleteCommand when passed DataRow collection with deleted rows.
I tryed to solve it on my own but i cant seem to fix it. So if anyone can give me an advice i will be very thankful. Here is my code.
currentRow = e.RowIndex;
ds1 = new DataSet();
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=DataSource/PhoneBookData.mdb";
con.Open();
string sql = "SELECT * From CONTACT";
da = new System.Data.OleDb.OleDbDataAdapter(sql, con);
da.Fill(ds1, "CONTACT");
DataRow dRow = ds1.Tables["CONTACT"].Rows[0];
ds1.Tables["CONTACT"].Rows[currentRow].Delete();
da.Update(ds1, "CONTACT");
Thanks for all the help in advance.
The exception is exact on what your problem is – you are missing the DeleteCommand in the adapter: