Sousa Pambo

Sousa Pambo

  • NA
  • 92
  • 24k

dataset error

Oct 16 2015 12:38 PM
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
 
 

Answers (2)