gridview里rowdeleting的代码
protectedvoidGridView1_RowDeleting(objectsender,GridViewDeleteEventArgse) ...
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int index = GridView1.DataKeys[e.RowIndex].Value;//这里有错 string DeleteCommand = "DELETE FROM GreenHouseInfo WHERE GhID = "+ index +""; DataAccess.ExecuteSql(DeleteCommand); }datakeynames写的是GhID这样写运行时,会出错错误 5 无法将类型“object”隐式转换为“int”。存在一个显式转换(是否缺少强制转换?) 请问应该怎么写?谢谢
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询