Gridview删除按钮不工作

Gridview删除按钮不工作,gridview,sqldatasource,Gridview,Sqldatasource,我正在尝试使我的网页能够使用网格视图从管理页面编辑数据库(ImportantNews)。但是,当我单击“删除”时,它只刷新页面,不删除任何内容。我正在使用ASP.NET2.0 Gridview 控件 我按照人们的建议做了,结果出现了这个错误 必须声明标量变量“@Content”。 描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源 异常详细信息:System.Data.SqlClient.SqlException:必须声明标量变量“@

我正在尝试使我的网页能够使用网格视图从管理页面编辑数据库(ImportantNews)。但是,当我单击“删除”时,它只刷新页面,不删除任何内容。我正在使用ASP.NET2.0

Gridview



控件
我按照人们的建议做了,结果出现了这个错误
必须声明标量变量“@Content”。 描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源

异常详细信息:System.Data.SqlClient.SqlException:必须声明标量变量“@Content”

源错误:

在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别

堆栈跟踪:

[SqlException(0x80131904):必须声明标量变量“@Content”。] System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)+1953274 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)+4849707 System.Data.SqlClient.TdsParser.throweexception和warning(TdsParserStateObject stateObj)+194 System.Data.SqlClient.TdsParser.Run(RunBehavior RunBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)+2392 System.Data.SqlClient.SqlCommand.RunExecuteOnQueryTds(字符串方法名,布尔异步)+192 System.Data.SqlClient.SqlCommand.InternalExecuteOnQuery(DbAsyncResult,String methodName,Boolean sendToPipe)+317 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()+137 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand命令,DataSourceOperation操作)+386 System.Web.UI.WebControls.SqlDataSourceView.executeElete(IDictionary键、IDictionary旧值)+303 System.Web.UI.DataSourceView.Delete(IDictionary键、IDictionary旧值、DataSourceViewOperationCallback)+89 System.Web.UI.WebControl.GridView.HandleDelete(GridViewRow,Int32 rowIndex)+714 System.Web.UI.WebControl.GridView.HandleEvent(EventArgs e、Boolean causesValidation、String validationGroup)+869 System.Web.UI.WebControl.GridView.RaisePostBackEvent(String eventArgument)+207 System.Web.UI.WebControl.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+175 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+1565

尝试添加DataKeyNames=“Content”