private void Updatebtn_Click(object sender, EventArgs e) { try { String cmd = String.Format("UPDATE Clo SET Name = '" + CloNametxtbox.Text + "', DateUpdated = '" + DateTime.Now + "' WHERE Id = '" + selectedId + "'"); int rows = SQLConnection.getInstance().exectuteQuery(cmd); MessageBox.Show(String.Format("{0} rows affected", rows)); CloNametxtbox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Savebtn_Click(object sender, EventArgs e) { try { String cmd = String.Format("INSERT INTO Clo(Name, DateCreated, DateUpdated) values('{0}','{1}', '{2}')", CloNametxtbox.Text, DateTime.Now, DateTime.Now); int rows = SQLConnection.getInstance().exectuteQuery(cmd); MessageBox.Show(String.Format("{0} rows affected", rows)); CloNametxtbox.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }