Mehmet Yilmaz

Mehmet Yilmaz

  • NA
  • 29
  • 2.2k

acces database row delete

Dec 19 2017 3:35 PM
The following command deletes the rows that contain "13856" in the corresponding rows in the Access database.
 
I want the rows containing "13856" to remain and the others rows to be deleted. So I want the exact opposite of what you did with the code below. please help me.
 
using (var myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + patch))
using (var myCommand = myConnection.CreateCommand())
{
var nameParam = new OleDbParameter("@k", "13856";
myCommand.CommandText = "DELETE FROM [bill] WHERE (k) = @k";
myCommand.Parameters.Add(nameParam);
myConnection.Open();
myCommand.ExecuteNonQuery();
}

Answers (3)