这是我的代码,它只是显示数字1 - 10 我希望它显示Sales表中的数字,来自表Songs
Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim dbCommand As OleDbCommand
Dim strInsert As String
Dim dbDataAdapter As OleDbDataAdapter
Dim dbProvider As String
Dim dbSource As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show(ListBox1.SelectedValue.ToString)
End Sub
Private Sub LoadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadToolStripMenuItem.Click
Dim Songs As New DataTable
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = F:\Assignment 2\Assignment 2\Assignment 2\Bin\Debug\MusicDatabase.mdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
Songs.Columns.Add("Sales", GetType(Integer))
For i As Integer = 1 To 10
Songs.Rows.Add(i)
Next
ListBox1.DisplayMember = "Sales"
ListBox1.ValueMember = "Sales"
ListBox1.DataSource = Songs
End Sub
End Class