Hi there,
I have problem with my DropDownBox, my datasource is from MySQL database. My problem is this, I have already stored data in my database let's say 12 rows, but when I am trying to fetch it on to dropdownbox, only 11 data will be the item values of the dropdownbox.

        myconnstring = "datasource=localhost;username=root;password=*******;database=**********;"
        comm = "SELECT * FROM players WHERE `team`='" & TeamBox.Text & "';"
        conn = New MySqlConnection(myconnstring)
        Try
            conn.Open()
            Try
                myCommand.CommandText = comm
                myCommand.Connection = conn
                myReader = myCommand.ExecuteReader
                While myReader.Read
                    If SPTexbox.Items.Count <= 12 Or SPnumTexbox.Items.Count <= 12 Then
                        SPTexbox.Items.Add(myReader("playernam"))
                        SPnumTexbox.Items.Add(myReader("plnum"))
                    End If
                End While
                conn.Dispose()
            Catch myerror As MySqlException
                'error message
            End Try
        Catch myerror As MySqlException
            'error message
        End Try

Datas from table row's 1-10 and 12, row 11 is not included.

if your try to run the query in mysql, what is the result?
and please put a proper error message to your catch block.
ex:

Catch myerror as MySqlException
    Msgbox("An error has occured. " & myerror.Message)
End Try

this will display a specific error message for easier debugging

Hi,

Row 11 could be different in some way did you manually populate the table? Is there a chance there is a leading or trailing space for example ("United" vs "United ")? Are the team names in the same case ("United" vs "united")

If you remove the clause about the count of the items and just populate the text box does it appear?

G Waddell
All rows are have the same case and spacing because, TeamBox.text is also a combobox, I just using .text in getting the selected item. The teams are already in there, only to choose what team.
I haven't tried yet in displaying another control.

Hi
Try this mod and see what happens:

 While myReader.Read
     SPTexbox.Items.Add(myReader("playernam"))
     SPnumTexbox.Items.Add(myReader("plnum"))
 End While
 conn.Dispose()

i.e. remove the limit on the item count and see if the row appears...

I changed already unto that, I didn't see the result yet because I used another pc.
By the way, why is it that if the project that is coded from 1pc cannot be change the output in another pc?

Hi,

Not sure what you ment by that last comment?

Do you mean you are coding the same code on two different machines?

Do you have a source code versioning application such as SourceSafe or SVN? You would need something like this to check in and out the source code from a central repository to the different machines that you code on. Your code is being held locally on the machine you develop on if you make a change on machine A and don't synch/port that change to machine B then your code is out of step.

If you mean you made the change and have two machines running the program but the change only appeared on machine A it may mean you have to redeploy (Or reinstall,) your program to machine B

Ok thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.