ado 数据源

打开工具栏的工程,选择部件, 然后再对话框中microsoft ado data control 6.0前打勾后确定就行了 

添加ado,connectionstring属性设置Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db_kfgl.mdb;Persist Security Info=False

recordsource 设置表 kf

DataCombo1组合框属性设置 rowsource  Adodc1  listfield 房间号 boundcolumn设置房间号

Private Sub DataCombo1_Click(Area As Integer)
Adodc2.RecordSource = "kf where 房间号='" + DataCombo1 + "'"
Adodc2.Refresh
With Adodc2.Recordset
If .RecordCount > 0 Then
For i = 0 To .Fields.Count - 1
If .Fields(i).Value <> "" Then
Text1(i).Text = .Fields(i).Value
Else
Text1(i).Text = ""
End If
Next i
End If
End With
End Sub

猜你喜欢

转载自www.cnblogs.com/zsp2/p/10031543.html
ADO