Avatar billede hyperactive Nybegynder
27. august 2003 - 18:35 Der er 1 løsning

Fejl ved split

Nedenstående kode genererer fejlen "Object reference not set to an instance of an object." i linien
arrCategories = strCategories.Split(",")



        Dim DbConnect As New DataAccess.objDataAccess()
        Dim DsCategories As New DataSet()
        DsCategories = DbConnect.RunSPReturnDS("Select_Categories", "Categories", New SqlParameter("@CategoryId", -1))
        Dim intRecordCount As Integer
        Dim intLoop As Integer
        Dim intCurItem = 0
        Dim intIndent As Integer
        Dim strIndent As String
        Dim strCategories As String
        intRecordCount = DsCategories.Tables(0).Rows.Count
        For intLoop = 0 To intRecordCount - 1
            If CInt(DsCategories.Tables(0).Rows(intLoop)("ParentCategoryId")) = CInt(intCurrentId) Then
                For intIndent = 1 To IntDepth
                    strIndent = strIndent & "  "
                Next
                strCategories = strCategories & (DsCategories.Tables(0).Rows(intLoop)("CategoryId")) & "," & strIndent & DsCategories.Tables(0).Rows(intLoop)("Description") & ","
                strCategories = strCategories & GetCategories(CInt(DsCategories.Tables(0).Rows(intLoop)("CategoryId")), IntDepth + 1)
            End If
        Next
        Dim arrCategories() As String
        arrCategories = strCategories.Split(",")
Avatar billede hyperactive Nybegynder
27. august 2003 - 19:46 #1
Lukket
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester