问题描述
用gridview的RowDeleting删除数据后,数据库内的数据删除不成功。为什么显示页面找不到了,“服务器已断开且未发送任何数据”?代码如下:protectedvoidgvCommOper_RowDeleting(objectsender,GridViewDeleteEventArgse){stringstrConn=System.Configuration.ConfigurationSettings.AppSettings["ConnStr"].ToString();OleDbConnectionmyConnection=newOleDbConnection(strConn);OleDbCommandmyCommand=newOleDbCommand("deletefromNewswhereid="+Convert.ToInt16(gvCommOper.DataKeys[e.RowIndex].Value).ToString(),myConnection);myCommand.Connection.Open();myCommand.ExecuteNonQuery();myCommand.Connection.Close();Response.Write("<script>alert('删除数据成功!');self.location.href=self.location.href;</script>");}
解决方案
解决方案二:
自己顶一下!
解决方案三:
刷新页面也找不到么?是不是连错库了?
时间: 2024-09-20 08:48:11