高手紧急求救!在线等待。一条关于datacombo的问题!!!
Dim oRS As New ADODB.Recordset
Dim oConn As New ADODB.Connection
'连接字符串的路径自己改过来
oConn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=qcxlk "
oRS.Open "select * from xlxmk ", oConn, adOpenDynamic, adLockOptimistic
Set DataCombo1.RowSource = oRS
DataCombo1.ListField = "xlxmsm "
DataCombo1.Text = xlxmh
我始终没有办法在修改datacombo的时候把相应的xlxmh值放到datacombo.text。
高手求救!!有什么办法呢?
[解决办法]
Private Sub Command1_Click()
Dim oRS As New ADODB.Recordset
Dim oConn As New ADODB.Connection
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\haoz\My Documents\aa.mdb;Persist Security Info=False "
oRS.CursorLocation = adUseClient
oRS.Open "select * from aa ", oConn.ConnectionString, adOpenDynamic, adLockOptimistic, adCmdText
Set DataCombo1.RowSource = oRS
DataCombo1.ListField = "x "
DataCombo1.Text = oRS.Fields( "x ").Value
End Sub
你的要求没看明白,是不是datacombo填充后,想显示出字段值?