Imports MySql.Data.MySqlClient

Public Class Form1
    Public sConnection As New MySqlConnection
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If sConnection.State = ConnectionState.Closed Then
            sConnection.ConnectionString = "SERVER = localhost; USERID = root; PASSWORD =; DATABASE = vb;"
            sConnection.Open()
        End If

        LoadPeople()

    End Sub

    Public Sub LoadPeople()
        Dim sqlQuery As String = "SELECT * FROM tbl_people"
        Dim sqlAdapter As New MySqlDataAdapter
        Dim sqlCommand As New MySqlCommand
        Dim TABLE As New DataTable
        Dim i As Integer

        With sqlCommand
            .CommandText = sqlQuery
            .Connection = sConnection
        End With

        With sqlAdapter
            .SelectCommand = sqlCommand
            .Fill(TABLE)
        End With

        For i = 0 To TABLE.Rows.Count - 1
            With lvPeople
                .Items.Add(TABLE.Rows(i)("id"))
                With .Items(.Items.Count - 1).SubItems
                    .Add(TABLE.Rows(i)("fname"))
                    .Add(TABLE.Rows(i)("mname"))
                    .Add(TABLE.Rows(i)("lname"))
                End With
            End With
        Next
    End Sub
End Class

please put break point in Loadpeople method and see are you getting the connectionto DB? and are you getting any records in TABLE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.