c# delete
我觉得这个onclick事件没有问题,但是删除的时候没效果啊,烦躁
protected void Button1_Click(object sender, EventArgs e)
{
string a = DropDownList1.SelectedItem.Text;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|db1.mdb";
OleDbCommand comm = new OleDbCommand();
conn.Open();
comm.Connection = conn;
comm.CommandText = "DELETE FROM position WHERE 岗位名称 = 'a ' ";
conn.Close();
}
大家帮我看下是什么原因!感谢
[解决办法]
comm.CommandText = "DELETE FROM position WHERE 岗位名称 = 'a ' ";
后添加comm.ExcuteNonQuery();
没执行当然不成功
[解决办法]
加上
OleDbCommand.ExecuteNonQuery();
不执行怎么有效果
[解决办法]