求助!在GridView 里删除数据库中的一行出错!
在GridView中添加了一列LinkButton的“删除”,当点击这button时出现
除非指定了 DeleteCommand,否则数据源“SqlDataSource1”不支持删除操作。
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string sqlstr = null;
sqlstr = "delete from Product where cProductId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
SqlConnection conn = new SqlConnection("Server=localhost;database=MyShop;user id=sa;password=123456");
conn.Open();
SqlCommand comm = new SqlCommand(sqlstr);
GridView1.DataBind();
}