未将对象引用设置到对象的实例!在线等待
添加数据到sql server 表内
错误定位在行47
“/myweb”应用程序中的服务器错误。
--------------------------------------------
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
行 45: Dim bumen As String
行 46: bumen = Request.QueryString( "bumeid ")
行 47: bumen = bumen.Substring(bumen.Length() - 2, 3)
行 48: Dim bumeid As Integer
行 49: bumeid = CInt(bumen)
代码如下:
Imports System.Data.SqlClient
Public Class RecordAdd
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents xing As System.Web.UI.WebControls.Label
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents TextName As System.Web.UI.WebControls.TextBox
Protected WithEvents TextWangye As System.Web.UI.WebControls.TextBox
Protected WithEvents TextXingbie As System.Web.UI.WebControls.TextBox
Protected WithEvents TextXueli As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents FONT1 As System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents Textbumen As System.Web.UI.WebControls.TextBox
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是