public void Update(MyClient mc) { try { conn.Open(); string query = string.Format("UPDATE tblClient SET clientName='{0}',clientSurname='{1}','clientIDnumber={2}','clienttelephoneNumber WHERE clientID='{3}'", mc.Name, mc.Surname, mc.IdNumber, mc.PhoneNumber); SqlCommand comm = new SqlCommand(query, conn); comm.ExecuteNonQuery(); MessageBox.Show("Client Has Been Updated"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } }
public void Insert(MyClient mc) { try { conn.Open(); string query = string.Format("INSERT INTO tblClient(clientName,clientSurname,clientIDnumber,clienttelephone) VALUES('{0}','{1}','{2}','{3}')", mc.Name, mc.Surname, mc.IdNumber, mc.PhoneNumber); SqlCommand comm = new SqlCommand(query, conn); comm.ExecuteNonQuery(); MessageBox.Show("Client Has Been Added"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } }