vb中用combobox下拉选择数据库中货品名中的一项,怎么让选定的货品名对应的单价显示在text框中?
PrivateSubForm_Load()DimcnAsNewADODB.ConnectionDimRsAsNewADODB.Recordsetcn.Open"Provi...
Private Sub Form_Load()
Dim cn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\manager.mdb;Persist Security Info=False"
Rs.Open "select distinct 货品名 from 货品", cn, adOpenKeyset, adLockOptimistic
Rs.MoveFirst
Do While Not Rs.EOF
Combo3.AddItem Rs.Fields("货品名")
Rs.MoveNext
Loop
Rs.Close
cn.Close
End Sub
这是之前的代码 展开
Dim cn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\manager.mdb;Persist Security Info=False"
Rs.Open "select distinct 货品名 from 货品", cn, adOpenKeyset, adLockOptimistic
Rs.MoveFirst
Do While Not Rs.EOF
Combo3.AddItem Rs.Fields("货品名")
Rs.MoveNext
Loop
Rs.Close
cn.Close
End Sub
这是之前的代码 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询