Advertisement
Guest User

Untitled

a guest
May 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. private void metroTile1_Click(object sender, EventArgs e)
  2. {
  3. try
  4. {
  5. OleDbConnection connection = new OleDbConnection();
  6. connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\user\Desktop\Student\Database.accdb;
  7. Persist Security Info=False;";
  8. connection.Open();
  9.  
  10. OleDbCommand com1 = new OleDbCommand();
  11. com1.Connection = connection;
  12. string qu = "update [Student] set [std-name]='" + Name_txt.Text + "' ,[Phone]='" + Phone_txt.Text + "' ,[Address]='" + Address_txt.Text + "' ,[Email]='" + Email_txt.Text + "' ,[Grander]='" + Grander_txt.Text + "' ,[Birthday]='" + Birthday_txt.Text + "' ,where [ID]='" + Load_txt.Text + "'";
  13. com1.CommandText = qu;
  14. com1.ExecuteNonQuery();
  15. MessageBox.Show("Update Completed", "Completed", MessageBoxButtons.OK, MessageBoxIcon.None);
  16. connection.Close();
  17.  
  18. }
  19. catch (Exception ex)
  20. {
  21. MessageBox.Show(ex.ToString(), "error");
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement