Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. private void cmdSave_Click(object sender, EventArgs e)
  2. {
  3. try
  4. {
  5. con = new OleDbConnection(cs.DBConn);
  6. con.Open();
  7.  
  8. string queryInsert = @"INSERT INTO tblFixing(CodBefore)
  9. VALUES
  10. (@CodBefore)";
  11. cmd = new OleDbCommand(queryInsert);
  12. cmd.Connection = con;
  13.  
  14. cmd.Parameters.Add(new OleDbParameter("@CodBefore", OleDbType.WChar, 0, "CodBefore"));
  15.  
  16. cmd.Parameters["@CodBefore"].Value = rchCodBefore.Text.Trim();
  17.  
  18. cmd.ExecuteNonQuery();
  19. MessageBox.Show("Successfully saved", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
  20. cmdSave.Enabled = false;
  21.  
  22. con.Close();
  23. }
  24. catch (Exception ex)
  25. {
  26. MessageBox.Show("ErrornDetalhes: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement