Hi friends I need help on vb.net dataset code, see bellow
Public Sub lstFuncIdNome(ByVal l As ListView, ByVal nome As String)
l.Items.Clear()
Dim dsMov As DataSet
Dim sql As String = ""
sql = "select func_id,apelido,func_nome,func_contacto from funcionario where nome like '" & nome & "%'" ' or apelido like '%" & nome & "%')" ' and id like '" & id & "%' order by nome asc"
dsMov = func.getStudentData(sql)
For k As Integer = 0 To dsMov.Tables("data").Rows.Count - 1 ----- this is error line code "Object reference not set to an instance of an object."
lstview = l.Items.Add(dsMov.Tables("data").Rows(k)("func_id").ToString)
lstview.SubItems.Add(dsMov.Tables("data").Rows(k)("func_nome").ToString + " " + dsMov.Tables("data").Rows(k)("apelido").ToString)
Try
lstview.SubItems.Add(dsMov.Tables("data").Rows(k)("func_contacto").ToString)
Catch ex As Exception
lstview.SubItems.Add("")
End Try
Next
dsMov.Clear()
End Sub
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sujeet SumanPosted Oct 16, 2015, 1:50 PM
Priyaranjan K SPosted Oct 16, 2015, 12:48 PM