SQL数据库名为CZ
控件名DATACOMBO1
我ADODB把查询结果集合在了DB.
Dim conn As New ADODB.Connection
Dim db As New ADODB.Recordset
Dim com As New ADODB.Command
Dim mmm As String
Dim sql As String
mmm = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=boos1;Data Source=BENQ1"
conn.ConnectionString = mmm
conn.Open mmm
sql = "select * from CZ where 车站代码='" & xxx & "' " 'XXX是我要查询的变量
db.CursorLocation = adUseClient
db.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not db.EOF = True Then
'这里我不会写怎么让DATACOMBO1的下拉列表显示DB的内容
End If
Close db
Close conn
Set db = Nothing
Set conn = Nothing
请高手指点
查询SQL数据库用DATACOMBO在下拉列表找显示的问题