Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Update_Click(object sender, EventArgs e)
- {
- try
- {
- OleDbConnection connection = new OleDbConnection();
- connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\user\Desktop\Student\Database.accdb;
- Persist Security Info=False;";
- connection.Open();
- OleDbCommand command1 = new OleDbCommand();
- command1.Connection = connection;
- command1.CommandText = "select * from Student where ID=" + Load_txt.Text;
- OleDbDataAdapter da = new OleDbDataAdapter(command1);
- DataTable dt = new DataTable();
- da.Fill(dt);
- dataGridView1.DataSource = dt;
- command1.ExecuteNonQuery();
- connection.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString(), "error");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement