指定的参数已超出有效值的范围。 参数名: value 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码

lzx1986 2009-04-21 09:58:39
我的表结构是这样的
表 学生课程记录表
id 学号 课程编号
1 510331101 1111
表 课程信息表
已选人数 课程编号
3 1111
目的是在删除学生课程记录表中这条记录然后让课程信息表的已选人数字段-1
触发器为
CREATE TRIGGER 课程信息表1 ON [dbo].[学生课程记录表]
FOR DELETE
AS
begin
update 课程信息表 set 已选人数=已选人数-1 from (select 课程编号 from deleted) d where 课程信息表.课程编号=d.课程编号
end

在查询分析器里执行没问题但是我作为网站的后台数据库在前台页面里的gridview控件里删除记录就会出现这个错误:
指定的参数已超出有效值的范围。
参数名: value
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。
参数名: value

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:


[ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。
参数名: value]
System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value) +1522711
System.Web.UI.WebControls.GridView.HandleDeleteCallback(Int32 affectedRows, Exception ex) +354
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +123
System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +927
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1134
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


我是用visual studio 2008 (C#)语言做的网站
请帮忙解决下!!谢谢!!
...全文
2605 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lianjiatianzhao 2011-09-17
  • 打赏
  • 举报
回复
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

超时时间已到。在操作完成之前超时时间已过或服务器未响应。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Data.SqlClient.SqlException: 超时时间已到。在操作完成之前超时时间已过或服务器未响应。

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:


[SqlException (0x80131904): 超时时间已到。在操作完成之前超时时间已过或服务器未响应。]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
HOSoft.Herp4.Framework.SQLHelper.QuerySP(String connectionString, String beforeSQLString, String SQLString, HerpSqlPager hspPager) in E:\Herp4.0\hfx4\SQLHelper.cs:413
HOSoft.Herp4.DAL.House.CustomerConsignUtil.Search(Int64 CurrentCompanyID, HerpSearch SearchXml, HerpSqlPager SqlPager, Boolean Detail) +34052
HOSoft.Herp4.BLL.House.CustomerConsign.Search(Int64 CurrentCompanyID, HerpSearch SearchXML, HerpSqlPager SqlPager, Boolean Detail) +101
HOSoft.Herp4.Web.UI.House.CustomerConsignList.GetData() +13589
HOSoft.Herp4.Web.UI.WebControls.HSGridViewSP.GetCachedData(Boolean Reload) in E:\Herp4.0\hwc4\Grid\HSGridViewSP.cs:488
HOSoft.Herp4.Web.UI.WebControls.HSGridViewSP.OnPageIndexChanging(GridViewPageEventArgs e) in E:\Herp4.0\hwc4\Grid\HSGridViewSP.cs:250
System.Web.UI.WebControls.GridView.HandlePage(Int32 newPage) +86
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +464
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207
System.Web.UI.WebControls.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(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
请问经常出现是怎么回事?

itcrazyman 2009-04-21
  • 打赏
  • 举报
回复
mark up 帮顶
sohighthesky 2009-04-21
  • 打赏
  • 举报
回复
是的,把报错的那附近的代码贴出来看看
jietuan 2009-04-21
  • 打赏
  • 举报
回复
这个是datagrid事件里面你写的代码有问题,跟数据库操作代码没关,你检查一下你写的datagrid相关代码。

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧