为什么不能删除数据呢?
string deleteCmd="delete from tblbooks where BookID like '@bookid'";
cmd=new SqlCommand(deleteCmd,con);
cmd.Parameters.Add(new SqlParameter("@bookid",SqlDbType.Char,10));
cmd.Parameters["@bookid"].Value=this.TxtBookID.Text;
try
{
cmd.ExecuteNonQuery();
MessageBox.Show("删除成功");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
cmd.Connection.Close();
}
this.TxtBookID.Text="";
this.TxtBookName.Text="";
this.TxtBookState.Text="";
}
这是在删除按钮里面执行的,提示删除成功,但是数据库里面还有,为什么啊,怎么修改一下呢?