我正在使用ibmDB2和VB6.0,尝试从数据库中检索数据并将其显示在我的搜索功能的组合框中。表名是Supplier,我想在组合框中显示的列是Supp_CompanyName。
但是在完成编码之后,我在Private Sub Form部分的do循环中面临“Expected:End of Statement”错误。 有关如何解决此错误的想法吗?
以下是我查看供应商信息表的代码:
Private Sub Combo1_Change()
Adodc1.RecordSource = "select * from Supplier where Supp_CompanyName='" & Combo1 & "'"
Adodc1.Refresh
End Sub
Private Sub Command1_Click()
Adodc1.RecordSource = "Select * from Supplier "
Adodc1.Refresh
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=IBMDADB2.DB2COPY1;Data Source=ToyStore"
Combo1.Clear
Adodc1.RecordSource = "Select distinct Supp_CompanyName from Supplier"
Adodc1.Refresh
With Adodc1.Recordset
Do Until .EOF
Combo1.AddItem ![Supp_CompanyName]
.MoveNext
Loop
End With
Adodc1.RecordSource = "Supplier"
Adodc1.Refresh
End Sub