VB + MYSQL list more than 1 result

mysql , vb6 United Kingdom
  • 13 years ago
        im having problems with getting this code to display more than 1 result, im used to using PHP and just started VB last night.

    to me when getting results from mysql it would display all the results unless u put in "limit" but i guess VB is different than PHP when it comes to this.

    could someone take a look please and tell me how i can get this code to display 10 results insted of just the 1?

    thanks


    [code start]

    Option Explicit

    Private Sub Form_Load()
    Dim cnMySql As New rdoConnection
    Dim rdoQry As New rdoQuery
    Dim mikecoQry As New rdoQuery
    Dim rdoRS As rdoResultset
    Dim WallpaperID As Integer
    Dim i As Integer


    ' set up remote data connection using the
    ' MySQL ODBC driver

    cnMySql.CursorDriver = rdUseOdbc
    cnMySql.Connect = [-password and connection info removed for posting-]
    cnMySql.EstablishConnection
    ' Select Wallpapers
        With rdoQry

         .Name = "select wallpaper"
     
         .SQL = "select * from wallpapers order by id DESC"
         .RowsetSize = 10

         Set .ActiveConnection = cnMySql
         Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer)

         mrbox.Text = rdoRS!Name & rdoRS!Image

    End With
    [code end]













































  • 13 years ago

    I can think of two things to check:

    Can the object you're using to display the results handle more than 1 line ?

    Can you assign all records of the recordset at once to the object, or do you have to cycle through the recordset, and add the values one by one ?

    Good luck,

    Erwin

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In theory, theory and practice are the same. In practice, they're not.”