解決しました!いくつかの領域で実験しただけで、何が問題を正確に解決したのかわかりません。:) まず、テーブルのフィールドのすべてのデータ型を数値からテキストに変更しました。第二に、form2_load とコンボボックス_selectedindexchanged のいくつかのコードを修正しました。
前:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "provider=microsoft.ace.oledb.12.0;data source = ..\Accounting2.accdb"
con.Open()
ComboBox1.SelectedIndex = 0
sSqlUser = "SELECT df, sdf, asdf FROM tbl_login ORDER BY df"
sSqlProduct = "SELECT cv, xcv, zxcv FROM tbl_product ORDER BY cv"
sSqlTransaction = "SELECT rt, ert, wert, qwert FROM tbl_transaction ORDER BY rt"
sSql = sSqlUser
Call FillList()
Dim dt As New DataTable
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex = 0 Then
sSql = sSqlUser
ElseIf ComboBox1.SelectedIndex = 1 Then
sSql = sSqlProduct
ElseIf ComboBox1.SelectedIndex = 2 Then
sSql = sSqlTransaction
End If
End Sub
それで:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "provider=microsoft.ace.oledb.12.0;data source = ..\Accounting2.accdb"
con.Open()
sSqlUser = "SELECT df, sdf, asdf FROM tbl_login ORDER BY df"
sSqlProduct = "SELECT cv, xcv, zxcv FROM tbl_product ORDER BY cv"
sSqlTransaction = "SELECT rt, ert, wert, qwert FROM tbl_transaction ORDER BY rt"
ComboBox1.SelectedIndex = 0
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex = 0 Then
sSql = sSqlUser
ElseIf ComboBox1.SelectedIndex = 1 Then
sSql = sSqlProduct
ElseIf ComboBox1.SelectedIndex = 2 Then
sSql = sSqlTransaction
End If
Call FillList()
Dim dt As New DataTable
End Sub