Public Sub fill_listview(ByVal query As String, ByVal lv As ListView)
Dim ds As New DataSet
ds = fill_dataset(query)
lv.Items.Clear()
lv.GridLines = True
lv.FullRowSelect = True
lv.HideSelection = False
Dim x, y As Integer
For x = 0 To ds.Tables(0).Rows.Count - 1
Dim lv_item As New ListViewItem
lv_item.Text = ds.Tables(0).Rows(x)(0).ToString()
For y = 1 To ds.Tables(0).Columns.Count - 1
lv_item.SubItems.Add(ds.Tables(0).Rows(x)(y).ToString())
Next
lv.Items.Add(lv_item)
Next
End Sub
Public Function fill_dataset(ByVal query As String) As DataSet
connect()
command.Connection = con
command.CommandText = query
command.ExecuteNonQuery()
Dim ds As New DataSet
adapter.SelectCommand = command
adapter.Fill(ds)
con.Close()
Return ds
End Function