A1VBCode Forums

system.indexoutofrangeexception error


http://www.a1vbcode.com/vbforums/Topic32267.aspx

By maybuang09 - 3/31/2015

hi guys could you help me with this error..?





here where the error occurs...



If sqlconn.State <> ConnectionState.Closed Then sqlconn.Close()

connectDB()

initCMD()

Try

query = "Select E.AppID as 'Applicant ID',E.FName as 'First Name',E.MName as 'Middle Name'," & _

" E.LName as 'Last Name' from tblEmpMaster as E" & _

" INNER JOIN tblLinks as L" & _

" ON E.AppID = L.fk_AppID" & _

" INNER JOIN tblRefInfo as I" & _

" ON L.RefID = I.RefID" & _

" where I.RefName = '" & cboRefCode.Text & "'"

Me.lvDetail.Items.Clear()

With sqlcmd

.CommandText = query

sqlDR = .ExecuteReader

End With



Do While sqlDR.Read

Item = Me.lvDetail.Items.Add(sqlDR!AppID.ToString)

Item.SubItems.Add(sqlDR!FName.ToString.Trim)

Item.SubItems.Add(sqlDR!MName.ToString.Trim)

Item.SubItems.Add(sqlDR!LName.ToString.Trim)

Loop

sqlDR.Close()

Catch ex As Exception

MsgBox(ex.ToString)

End Try