using System; using MySql.Data.MySqlClient; // required for MySQL namespace MySQLDemo { class ChangeEmail { static void Main(string[] args) { MySqlConnection con = new MySqlConnection("server=localhost;Database=mysql;Uid=root;Pwd=srikanth"); try { con.Open(); // parameters are created with ? followed by a name - ?email MySqlCommand cmd = new MySqlCommand("update addresses set email = ?email where name = ?name", con); cmd.Parameters.Add("?email", MySqlDbType.VarChar, 50).Value = "srikanthpragada@yahoo.com"; cmd.Parameters.Add("?name", MySqlDbType.VarChar, 30).Value = "P.Srikanth"; if (cmd.ExecuteNonQuery() == 1) Console.WriteLine("Updated Successfully"); else Console.WriteLine("Name Not Found"); } catch (Exception ex) { Console.WriteLine("Error-->" + ex.Message); } finally { con.Close(); } } // end of main } }