tehon3299 Posted March 26, 2003 Posted March 26, 2003 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. Quote Thanks, Tehon
*Gurus* Derek Stone Posted March 26, 2003 *Gurus* Posted March 26, 2003 The method depends on the ADO.NET code you're using. We'll need to see whether you're using a DataSet or a DataReader, among various other options. Quote Posting Guidelines
tehon3299 Posted March 26, 2003 Author Posted March 26, 2003 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() Quote Thanks, Tehon
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.