Adding to Listview

tehon3299

Centurion
Joined
Jan 6, 2003
Messages
155
Location
Liverpool, NY
I need to get all the items under a certain column in SQL and add them all to a Listview. How would I do this?

I know how to connect to SQL and add things to listview's but I don't know how to add them when it's from SQL.
 
This is the code I am using:
Visual Basic:
        Dim MyCommand As New SqlCommand()
        Dim MyConnection As New SqlConnection()
        Dim MySQLDataAdapter As New SqlDataAdapter()
        Dim SessionCmd As String

        MyConnection = New SqlConnection("server=(local);database=StatKeeper;Trusted_Connection=yes")

        SessionCmd = "Select (TeamName) FROM tmTeams"

        MyCommand = New SqlCommand(SessionCmd, MyConnection)

        MyCommand.Connection.Open()

        Try
            MyCommand.ExecuteNonQuery()
        Catch Exp As SqlException
            If Exp.Number = 2627 Then

            Else

            End If
        End Try

        MyCommand.Connection.Close()
 
Back
Top