请问版主:我的错在哪里呢?因为我的数据是在网上取来的,所以用了SQL服务器。
Private Sub UserForm_Initialize()
Dim cnn As New ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim str
DIM I
Set cnn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
On Error GoTo 1000
cnn.connectionstring="driver={SQLServer};server=SER;uid=test123;pwd=test123;Database=业务数据库"
cnn.Open
str = "Select 姓名 from 档案 "
rs1.Open str, cnn
rs1.MoveLast
rs1.MoveFirst
For I = 1 To rs1.RecordCount (读取rs1.RecordCount 不成功)
ComboBox1.AddItem rs1.Fields("姓名") (在下拉中未能显示姓名、但在ACEE中能正常显示)
rs1.MoveNext
Next I
Exit Sub
1000:
End Sub
[此贴子已经被作者于2005-1-5 11:22:36编辑过] |