private void btnUpdate_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ALNETTE\Desktop\New folder\AccessDatabase.accdb");
string Db = "Select * from StudentInfo";
OleDbCommand cmd = new OleDbCommand(Db, con);
try
{
con.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Update");
con.Close();
}
catch (Exception)
{
MessageBox.Show("error");
}
}
I have this code for my update but when I am updating it, it only updates the datagridview and not my database. What should I do to update it also in database?