[求助]combox查询SQL字段并显示下拉列表
使用connection已连接SQL数据库但怎样将数据库"AA"的表"BB"的字段"CC"的记录显示到COMBO1里(这个可以了)
并以下拉列表方式显示
下面这样可以也不行呀
Private Sub Form_Load()
Dim sql As String
Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
sql = "provider=sqloledb.1;persist security info=false;user id=sa;initial catalog=itkpc;data source=tpics-server"
cn.ConnectionString = sql
cn.Open
sq = "select * from itktz"
'Set rec = cn.Execute(sq)
'Adodc1.Refresh
rs.Open "select name from itktz", cn, 1, 3
Combo1.Clear
For icount = 0 To rs.RecordCount - 1
Combo1.AddItem rs(0)
rs.MoveNext
Next
rs.Close
Set rs = Nothing