我编写了一个提交信息的网页,使用了几个textbox和requirefieldvalidator控件。网页刚刚打开时没有问题,但在填完第一个控件,再把光标移到第二个控件时,就有如下的错误提示:
页面左下角有一个黄色的!,双击打开后查看详细信息如下:行:98
字符:1
错误:缺少对象
代码:0
url:localhost/test/apply.axpx后来我发现,只要把光标移到某个控件里再移出来,都会有这样的错误提示!!!请注意:这个也页面的功能完全可以使用!就是有这个该死的错误提示,烦!高手快指点我啊,我初学2周,实在是不知道原因啊

解决方案 »

  1.   

    基本上没写什么代码:)Imports System.Data.SqlClientPublic Class WebForm1
        Inherits System.Web.UI.Page#Region " Web 窗体设计器生成的代码 "    '该调用是 Web 窗体设计器所必需的。
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()    End Sub
        Protected WithEvents CompareValidator1 As System.Web.UI.WebControls.CompareValidator
        Protected WithEvents dept As System.Web.UI.WebControls.DropDownList
        Protected WithEvents CompareValidator2 As System.Web.UI.WebControls.CompareValidator
        Protected WithEvents RequiredFieldValidator2 As System.Web.UI.WebControls.RequiredFieldValidator
        Protected WithEvents RequiredFieldValidator4 As System.Web.UI.WebControls.RequiredFieldValidator
        Protected WithEvents RegularExpressionValidator1 As System.Web.UI.WebControls.RegularExpressionValidator
        Protected WithEvents button1 As System.Web.UI.WebControls.Button
        Protected WithEvents reply As System.Web.UI.WebControls.Label
        Protected WithEvents applicant As System.Web.UI.HtmlControls.HtmlInputText
        Protected WithEvents device As System.Web.UI.HtmlControls.HtmlInputText
        Protected WithEvents num As System.Web.UI.HtmlControls.HtmlInputText
        Protected WithEvents reason As System.Web.UI.HtmlControls.HtmlTextArea
        Protected WithEvents today As System.Web.UI.HtmlControls.HtmlInputText
        Protected WithEvents Requiredfieldvalidator5 As System.Web.UI.WebControls.RequiredFieldValidator
        Protected WithEvents phone As System.Web.UI.HtmlControls.HtmlInputText
        Protected WithEvents RequiredFieldValidator3 As System.Web.UI.WebControls.RequiredFieldValidator    '注意: 以下占位符声明是 Web 窗体设计器所必需的。
        '不要删除或移动它。
        Private designerPlaceholderDeclaration As System.Object    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
            '不要使用代码编辑器修改它。
            InitializeComponent()
        End Sub#End Region    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
            Dim strConn As String
            Dim strComm As String
            Dim oConn As SqlConnection
            Dim oComm As SqlCommand
            Dim updateFlag As Integer        strConn = "server=localhost;user id=idowin;password=idowin;initial catalog=adt;"
            strComm = "insert into adt(applicant, phone, dept, device, num, today, reason) values('" & applicant.Value & "','" & phone.Value & "','" & dept.SelectedItem.Text & " ','" & device.Value & "','" & num.Value & "','" & today.Value & " ','" & reason.Value & "')"        oConn = New SqlConnection(strConn)
            oComm = New SqlCommand(strComm, oConn)        Try
                oConn.Open()
                updateFlag = oComm.ExecuteNonQuery()
                If (updateFlag <> -1) Then
                    reply.Text = "信息提交成功!"
                End If
            Catch ex As Exception
                reply.Text = "数据库写入错误!"
            Finally
                oConn.Close()
            End Try
        End Sub    Private Sub device_ServerChange(ByVal sender As System.Object, ByVal e As System.EventArgs)    End Sub
    End Class