I'm trying to put to array my SQL query string but I encounter this error
An unhandled exception of type 'System.NullReferenceException' occurred
What is the possible problem I have?
Dim myList As ArrayList
Dim cnt As Integer
cnt = lvTrans.SelectedItems.Count
For values As Integer = 0 To cnt
Dim vals1 = lvTrans.FocusedItem.SubItems(9).Text()
sqlString2 = " UNION " & _
"SELECT * FROM tbltransmital_mkk t INNER JOIN tbltransmital1_mkk t1 ON t.transmital_no = t1.transmital_no WHERE t.transmital_no='" & txtTrans.Text & _
"' AND t1.autokey ='" & vals1 & "'"
myList.Add(sqlString2)
Next
sqlString = sqlString1 & sqlString2
MsgBox(sqlString)