Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Thanks,

Tehon

Posted

This is the code I am using:

        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()

Thanks,

Tehon

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...