Fejl ved split
Nedenstående kode genererer fejlen "Object reference not set to an instance of an object." i linienarrCategories = 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(",")
