我试图在颜色列中显示一个值列表,但是当我单击按钮时它只给我一个值
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
''TODO: This line of code loads data into the '''AdventureWorksLTDataSet.Product' table. You can move, or remove it, as needed.
Me.ProductTableAdapter.Fill(Me.AdventureWorksLTDataSet.Product)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim conDB As New OleDb.OleDbConnection
conDB.ConnectionString = "....."
Dim comDB As New OleDb.OleDbCommand
Dim dbrDB As OleDbDataReader
Dim SQLQuery As String
conDB.Open()
comDB.Connection = conDB
SQLQuery = "SELECT DISTINCT P.color FROM SalesLT.Product P WHERE P.color is not NULL"
comDB.CommandText = SQLQuery
dbrDB = comDB.ExecuteReader()
If (dbrDB.Read) Then
While dbrDB.Read ' 'cycle through resulting tuples
Label1.Text = dbrDB("color")
End While
End If
End Sub
End Class