Export (0) Print
Expand All

ADO Data-Bound Controls

Visual Studio .NET 2003

The following data-bound controls display data from the ADO data control. See Inserting the Control into a Visual C++ Application and Setting Control Properties at Design Time for information on using ActiveX controls.

Control name and support files Description
Microsoft DataCombo

Msdatlst.ocx

DBList98.chm

The DataCombo control allows retrieved data to appear in a drop-down combo box.

To link the DataCombo control to a data source

  1. Set the DataSource and the RowSource properties to an ADO data control.
  2. Set the DataField and ListField properties to the desired fields.
  3. DataSource and DataField govern the active value of the control. RowSource and ListField allow the display of column data other than the current record. You can also set BoundColumn; this property represents the value of the control when it is made into a variable in an MFC application.
Microsoft DataGrid

Msdatgrd.ocx

DBGrid98.chm

DataGrid can hold text data, but not linked or embedded objects. The AllowAddNew, AllowDelete, and AllUpdate properties allow the DataGrid to modify data.
Microsoft DataList

Msdatlst.ocx

DBList98.chm

The DataList control allows retrieved data to appear in a drop-down list box.

To link the DataList control

  1. Set the DataSource and the RowSource properties to an ADO data control.
  2. Set the DataField and ListField properties to the desired fields.
  3. DataSource and DataField govern the active value of the control. RowSource and ListField allow the display of column data other than the current record. You can also set the BoundColumn value. This value represents the value of the control when it is made into a variable in an MFC application.
Microsoft DataRepeater

Msdatrep.ocx

DatRpt98.chm

The DataRepeater control is a composite control; a control that hosts other controls. It allows you to specify a control to repeat, and when bound, displays the selected control for each record retrieved. The DataRepeater will then allow end users to scroll through the retrieved records.

To link the DataRepeater control

  1. In the All property tab, set the DataSource property to an ADO data control.
  2. In the All property tab, select a control to repeat for the Repeated Control Name property.
  3. Once a control is selected, click the RepeaterBindings tab.
  4. Set a property name to bind. The drop-down box will enumerate bindable properties in the control to be repeated.
  5. Set a data field. The drop-down box will enumerate column names returned from the bound ADO data control.
  6. Click the Add button to add the binding. The RepeaterBindings list box will then populate with the new binding.

The DataRepeater control also ships separately with Visual Studio 6.0 or later.

Microsoft Hierarchical FlexGrid

Mshflxgd.ocx

MsHFlx98.chm

The Hierarchical FlexGrid control displays tabular data. Unlike the DataGrid, it is strictly read-only. However, it can sort, merge, and format tables containing strings and pictures. Additionally, the Hierarchical FlexGrid differs from its predecessor, the FlexGrid, in that it can display both summary data and detail data.

A hierarchical rowset is required to display summary-detail information in the Hierarchical FlexGrid control. To create a hierarchical rowset for this control, the Microsoft Data Shape Provider is required in combination with the ADO data control.

To use the Hierarchical FlexGrid

  1. Use the ADO data control to set the ConnectionString property to specify the Microsoft Data Shape Provider. For example:
    Provider=MSDataShape.1;Data Source=myPubsDataSource
    
  2. Set the RecordSource property to use Microsoft Data Shape Provider syntax to create a hierarchical rowset. For example:
    SHAPE {select * from authors} APPEND ({select * from titleauthor} AS chapter RELATE au_id TO au_id)
    
  3. Set the DataSource property of the Hierarchical FlexGrid control to the ADO data control configured above.

For additional information on data shaping see the topic Hierarchical Cursors and Data Shaping in the ADO Programmer's Reference.

Microsoft Chart

Mschart.ocx

MSchrt98.chm

The Chart control displays an array of data as a graph. It can display both two-dimensional and three-dimensional graphs. When data-bound, it treats the retrieved rowset as an array of data.

To link the Chart control

  1. Set the DataSource property to an ADO data control.

It is recommended that the ADO data control's database query retrieve a rowset of aggregate information such as count(*), sum(*), min(*), and max(*).

Previous versions of the MS Chart control were RDO based.

Note   The Chart control ships with Visual Studio 6.0 or later (not Visual C++), so you must have a Visual Studio 6.0 or later license to redistribute it.

See Also

ActiveX Controls that Support Databinding

Show:
© 2015 Microsoft