DropDownBox in VB.NET 2010
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.
Related Article: Publishing Problem in VB.net 2010
is a solved VB.NET discussion thread by kenth21v that has 2 replies, was last updated 9 months ago and has been tagged with the keywords: deployment, publishing, vb.net.
monching
Junior Poster in Training
68 posts since Oct 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0
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
Practically a Master Poster
618 posts since Nov 2009
Reputation Points: 107
Solved Threads: 92
Skill Endorsements: 5
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.
monching
Junior Poster in Training
68 posts since Oct 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0
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...
G_Waddell
Practically a Master Poster
618 posts since Nov 2009
Reputation Points: 107
Solved Threads: 92
Skill Endorsements: 5
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?
monching
Junior Poster in Training
68 posts since Oct 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0
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
G_Waddell
Practically a Master Poster
618 posts since Nov 2009
Reputation Points: 107
Solved Threads: 92
Skill Endorsements: 5
monching
Junior Poster in Training
68 posts since Oct 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0
Question Answered as of 3 Months Ago by
G_Waddell
and
daniel955