错误出现在那里呢
错误在那里?Namespace aspx
Partial Class ExamPaper
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Dim sqlstr As New aspx.sqllangue.sqllangue
Dim sqlselect As String
Private Sub errorshow()
If Me.Session("error") <> "" Then
Me.Response.Write(Me.Session("error"))
Me.Response.End()
End If
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
loadtable()
End Sub
Private Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
Me.Session("pageno") = e.NewPageIndex
loadtable()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Response.Redirect("epadd.aspx")
End Sub
Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged
Dim rowsid As Integer = Me.DataGrid1.CurrentPageIndex * Me.DataGrid1.PageSize + Me.DataGrid1.SelectedIndex
Me.Session("selectid") = sqlstr.sqlds.Tables("temporary").Rows(rowsid).Item(0)
Me.Response.Redirect("EPedit.aspx")
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
Me.Session("shijuanid") = e.Item.Cells(0).Text
Me.Session("shijuanname") = e.Item.Cells(1).Text
Me.Session("shijuanstyle") = e.Item.Cells(2).Text
Me.Session("shijuanfanwei") = e.Item.Cells(3).Text
Me.Response.Redirect("EPtype.aspx")
End Sub
Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand
Dim rowsid As Integer = Val(e.Item.Cells(0).Text)
Dim dsrowsid As Integer = sqlstr.sqlds.Tables("temporary").Rows.Count() - 1
If sqlstr.sqlds.Tables("temporary").Rows(dsrowsid).Item(0) = rowsid Then
Me.Session("pageno") -= 1
End If
sqlstr.delEP(e.Item.Cells(0).Text)
loadtable()
End Sub
Public Sub loadtable()
sqlstr.sqlconn.Close()
sqlstr.conn()
errorshow()
sqlselect = "select * from exampaper order by stime DESC"
sqlstr.sqlds.Clear()
sqlstr.sqlselect(sqlselect)
errorshow()
Me.DataGrid1.DataSource = sqlstr.sqlds.Tables("temporary").DefaultView
Me.DataGrid1.CurrentPageIndex = Me.Session("pageno")///这一行出现错误
Me.DataGrid1.DataBind()
End Sub
End Class
End Namespace
指定的参数已超出有效值的范围。
参数名: value
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。
参数名: value
源错误:
行 75: errorshow()
行 76: Me.DataGrid1.DataSource = sqlstr.sqlds.Tables("temporary").DefaultView
行 77: Me.DataGrid1.CurrentPageIndex = Me.Session("pageno")///这一行出现错误
行 78: Me.DataGrid1.DataBind()
行 79: End Sub