0

I want to run a query in c#

delete from dials 

Are there any suitable libraries that can help me run this query in c# windows form Application?

mason
  • 31,774
  • 10
  • 77
  • 121
M.Dagiya
  • 203
  • 3
  • 13

1 Answers1

0

Try this:

MySqlCommand cmd = new MySqlCommand("DELETE  from [tablenamehere] where Somethingunique=@unique",connectionstring)
cmd.Parameters.Add("@unique", MySqlDbType.VarChar).Value = somethinguniqueHere;
cmd.ExecuteNonQuery()
Software Dev
  • 5,368
  • 5
  • 22
  • 45
  • [Don't use AddWithValue() for code examples](https://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/). It leads to people using it in programs without knowing potential performance damage they are doing. – Joel Coehoorn Apr 02 '18 at 03:06
  • @JoelCoehoorn , i am sorry ... i always use and suggest `Add` instead of `Add with value..You can check my other answers such as [this](https://stackoverflow.com/questions/49596131/vb-net-how-to-add-a-value-number-in-my-form-with-a-value-number-in-my-database-a/49597366#49597366) ... I edited my qs now and now it's perfect :) – Software Dev Apr 02 '18 at 05:05