每次适配器向DataTable添加新行时,我都希望捕获TableNewRow
事件。
有没有办法捕获DataTable的NewRow事件?
string sql = "SELECT * FROM t_table";
command.CommandText = sql;
adapter.CommandText = command;
DataTable dt = new DataTable();
adapter.Fill(dt);
我在下面尝试过这段代码,但它不起作用..
dt.TableNewRow += new DataTableNewRowEventHandler(dt_TableNewRow);
private void dt_TableNewRow(object sender, DataTableNewRowEventArgs e)
{
MessageBox.Show("Event Raised...");
}