shaunrigby
New member
- Joined
- Mar 31, 2007
- Messages
- 4
- Programming Experience
- Beginner
Hi Guys,
I have the following while loop in my app, however when i run it only the last record from the DB is shown, in short, my app connects to the database and selects all records that meet criteria, then lists them all as labels, I have also tried adding it to a table layout panel howeverr that doesnt work either,
Please feel free to move my post if it is on the wrong section
I have the following while loop in my app, however when i run it only the last record from the DB is shown, in short, my app connects to the database and selects all records that meet criteria, then lists them all as labels, I have also tried adding it to a table layout panel howeverr that doesnt work either,
VB.NET:
[SIZE=2][COLOR=#0000ff]
Try
[/COLOR][/SIZE][SIZE=2]dbConn.Open()
dbReader = dbCommand.ExecuteReader()
[/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][SIZE=2] dbReader.Read()
incomeLabel.Text = dbReader.GetString([/SIZE][SIZE=2][COLOR=#800000]"description"[/COLOR][/SIZE][SIZE=2])
incomeLabel.Name = dbReader.GetString([/SIZE][SIZE=2][COLOR=#800000]"description"[/COLOR][/SIZE][SIZE=2])
incomeLabel.Location = textLocation
[/SIZE][SIZE=2][COLOR=#008000]'incomeLabel.Anchor = AnchorStyles.Top
[/COLOR][/SIZE][SIZE=2]incomeLabel.BackColor = Color.Transparent
textLocation.Y = textLocation.Y + 50
FlowLayoutPanel.Controls.Add(incomeLabel)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]While
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] MySqlException
MsgBox([/SIZE][SIZE=2][COLOR=#800000]"Query Error: "[/COLOR][/SIZE][SIZE=2] & ex.Message)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] MySqlException
MsgBox([/SIZE][SIZE=2][COLOR=#800000]"Connection Error: "[/COLOR][/SIZE][SIZE=2] & ex.Message)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE]
Please feel free to move my post if it is on the wrong section