![]() | Type | Description | ||
| Object | An Object that defines the control's data. Currently, the control supports ADO.Recordset, ADODB.Recordset objects, DAO recordsets |
The following VB sample binds the "Employees" table in the "NWIND.MDB"
database to the component, using an ADODB recordset:
Dim rs As Object, strNWIND As String
strNWIND = "D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB"
Set rs = CreateObject("ADODB.Recordset")
rs.Open "Employees", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & strNWIND, 3, 3 ' Opens the table using static mode
With Record1
.BeginUpdate
Set .DataSource = rs
With .Item("ReportsTo")
.EditType = DropDownListType
Dim i As Long
i = 1
.AddItem 0, "- <b>unspecified</b> -"
While Not rs.EOF
.AddItem rs("EmployeeID").Value, rs("FirstName").Value & " <b>" & rs("LastName").Value & "</b>"
i = i + 1
rs.MoveNext
Wend
rs.MoveFirst
End With
.EndUpdate
End With
The following VC sample binds the "Employees" table in the "NWIND.MDB" database to the component, using an ADODB recordset: