c# datagirdview table, delete a record, did not update directly. Need to exit the window and re-enter do delete. I hope you can give me a solution.
Get the table code as follows:
oleConnection1.Open();
string sql = "select * from txt ";
OleDbDataAdapter thisAdapter = new OleDbDataAdapter(sql, oleConnection1);
DataSet thisDataSet = new System.Data.DataSet();
thisAdapter.Fill(thisDataSet, "table");
DataTable dt = thisDataSet.Tables["table"];
dataGridView1.DataSource = dt;
< div class = "aw - list - img >
string sql = "delete from txt where id" + "="+dgv.Rows[e.RowIndex].Cells[0].Value.ToString().Trim()+"";
OleDbCommand cmd = new OleDbCommand(sql, oleConnection1);
cmd.ExecuteNonQuery();
updata();//这个updata 数据更新,方法代码不会。
MessageBox.Show("删除成功");
updata method code does not, please do me a favor.
updata()
{
请各位大侠帮忙写下 ,数据更新的代码。
}
What method, after deletion, directly reflected. There is no need to exit the window and re-enter.
Please reply positively, thank you very much, please have the detailed code.
0 Answer
No answer yet
这家伙很懒,什么都没留下...