Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net System.NullReferenceException:对象引用未设置为对象的实例。位于LicenseParser.RawDataReader.ParseIT(字符串LicenseID)_Asp.net_Vb.net_Nullreferenceexception_Object Reference - Fatal编程技术网

Asp.net System.NullReferenceException:对象引用未设置为对象的实例。位于LicenseParser.RawDataReader.ParseIT(字符串LicenseID)

Asp.net System.NullReferenceException:对象引用未设置为对象的实例。位于LicenseParser.RawDataReader.ParseIT(字符串LicenseID),asp.net,vb.net,nullreferenceexception,object-reference,Asp.net,Vb.net,Nullreferenceexception,Object Reference,我知道这个错误在这个网站上已经被提到好几次了,但我不知道为了修复我的代码,我具体需要修改什么运行以下代码时未识别LicenseID 主页:default.aspx.vb Public Class _Default Inherits System.Web.UI.Page Public Shared LicenseID As String Public Sub Page_Load(ByVal sender As Object, ByVal e As System.Even

我知道这个错误在这个网站上已经被提到好几次了,但我不知道为了修复我的代码,我具体需要修改什么运行以下代码时未识别LicenseID

主页:default.aspx.vb

Public Class _Default
    Inherits System.Web.UI.Page

    Public Shared LicenseID As String

    Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        LicenseID = Request.QueryString("LicenseID")
        TextBox4.Text = LicenseID

    End Sub

    Public Sub ParseData_Click(sender As Object, e As EventArgs) Handles GetXML.Click
        Dim XML As New GetXML
        Dim ReturnMessage As String = ""

        TextBox1.Text = XML.BuildStatus()
        TextBox2.Text = XML.ReadData(LicenseID)

        Dim RDR As New RawDataReader
    End Sub

End Class
下面是出现问题的类(RawDataReader)。潜艇就在那里。有人知道我需要将许可证ID移动到哪里吗?这似乎是一个范围问题

Public Class RawDataReader
    Inherits System.Web.UI.Page

    Public Lic As RawData.License
    Public msg As Object

    Public Sub deserializexml(ByRef Path As String)
        msg = "deserializeComplete"
        Try

            Dim s As New XmlSerializer(GetType(RawData.License))
            Dim fs As New FileStream(Path, FileMode.Open)
            Dim rdr As XmlReader = XmlReader.Create(fs)

            Lic = CType(s.Deserialize(rdr), RawData.License)

            fs.Close()

        Catch ex As Exception
        End Try

    End Sub

    Dim cn As Connection

    Public Sub New()
        cn = New Connection("Operations6")

    End Sub


    Public Sub ParseIT(LicenseID As String)

        Try
            msg = "deserializeComplete"

            For Each itm In Lic.Products

                cn.getScalar(" Exec LicenseUpsert " & _
                    "'" & LicenseID & "', " & _
                    "'" & itm.ProductName & "', " & _
                   "'" & itm.ExpiresOn & "'")


                If Not Lic.Products(0) Is Nothing Then
                    With Lic.Products(0)

                    End With
                End If
            Next

        Catch ex As Exception
            msg = ex.ToString()
        End Try
    End Sub
End Class
可能的重复可能的重复