1 Replies - 370 Views - Last Post: 09 May 2013 - 10:52 PM Rate Topic: -----

#1 DoxramosPS  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 156
  • Joined: 07-October 12

MySQL Query Only returning First Value of Result

Posted 09 May 2013 - 10:46 PM

I'm attempting to query a Server Database so that my program can have updates and such, but I'm running into a bit of an issue.
''Connect To SQL Server to Pull News Feed and such.
        ' create a new SqlConnection object with the appropriate connection string 
        Dim query As String = "SELECT title FROM news_feed WHERE active='1'"
        Dim connStr As String = "*************"
        Dim connection As New MySqlConnection(connStr)
        Dim cmd As New MySqlCommand(query, connection)
        connection.Open()
        Dim reader As MySqlDataReader
        reader = cmd.ExecuteReader()
        While reader.Read()
            Label1.Text = (reader.GetChar("title"))   '<- Kind of Working!
        End While


Now Say title in the SQL table is Test; My Label1 Will now read T. I'm looking for it to read test however not just the first value. Taking a look to try to fix it, but thinking it might be something of a facepalm moment.

Is This A Good Question/Topic? 0
  • +

Replies To: MySQL Query Only returning First Value of Result

#2 DoxramosPS  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 156
  • Joined: 07-October 12

Re: MySQL Query Only returning First Value of Result

Posted 09 May 2013 - 10:52 PM

Scratch the issue!
Label1.Text = (reader.GetString("title")) 'Fixed the problem


Thanks to any saviors who may have been on their way!
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1