主题:一个关于datagird删除的问题。。
高手帮看一下。下面代码错在哪里?
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string mid=this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
OleDbConnection cn=new OleDbConnection();
cn.ConnectionString="Provider=microsoft.jet.oledb.4.0; data source="+Server.MapPath("news.mdb");
OleDbCommand cmd=new OleDbCommand("delete from News where ID='"+mid+"'",cn);
cn.Open();
cmd.ExecuteNonQuery();
bing();
}
哪位有代码也可以拿出来让我看一下。最好是C#.NET的
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string mid=this.DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
OleDbConnection cn=new OleDbConnection();
cn.ConnectionString="Provider=microsoft.jet.oledb.4.0; data source="+Server.MapPath("news.mdb");
OleDbCommand cmd=new OleDbCommand("delete from News where ID='"+mid+"'",cn);
cn.Open();
cmd.ExecuteNonQuery();
bing();
}
哪位有代码也可以拿出来让我看一下。最好是C#.NET的