you can do this way:
private void showButton_Click(object sender, EventArgs e)
{
con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\ETMS\\ETMS\\ETMS\\etms.accdb");
String query = "SELECT * FROM Categories";
da = new OleDbDataAdapter(query, con);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
dt=new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
con.Close();
}
private void UpdateButton_Click(object sender, EventArgs e)
{
da.Update(dt);
}
for further info refer to following links:
Edit Almost Anything in a DataGrid[
^]
Auto Saving DataGridView Rows to a SQL Server Database[
^]
hope this helps :)
[Edit] by
Tadit
Corrected the second link's html.
As it was showing the whole html where new window icon is shown.
[/Edit]