ID: Q190214
The information in this article applies to:
When the Microsoft Chart Control 6.0 is databound using the ADO DataControl or the Data Environment, the first column in the resulting recordset must be of datatype Text (or a corresponding datatype based on the database in use.) The Chart control attempts to plot the data in the first column if it contains non-text values. The result of this can be a Chart that does not plot at all, or a Chart that contains additional (and unwanted) plots. This requirement is not discussed in the Visual Basic documentation.
The following example provides an illustration of a Chart that contains an additional data plot and provides a solution.
1. Create a new Standard EXE project in Visual Basic. Form1 is created by
   default.
   DataControl 6.0 (OLEDB)" and "Microsoft Chart Control 6.0." Click OK.
   These controls are now in the Toolbox.
4. Place an instance of the ADO DataControl, Adodc1, on Form1.
5. For this step, it may be necessary to adjust the path information for
   the Biblio.mdb database. Set the ConnectionString property of the ADO
   DataControl to:
      Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data
      Source=C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb
      SELECT Titles.[Year Published], Count(Titles.Title) AS CountOfTitle
      FROM Titles GROUP BY Titles.[Year Published];
      chartType:  VtChChartType2dLine
      datasource: Adodc1
   the data, and an additional red line that is the Chart Control's
   attempt to chart the non-text value of the first column of data.
   data to text. This can be accomplished by modifying the ADO Control's
   RecordSource property. The CStr function will be used for this example.
   This may require a different function depending on the type of database
   in use. Change the RecordSource property of the ADO DataControl to:
      SELECT cstr(Titles.[Year Published]), Count(Titles.Title) AS
      CountOfTitle FROM Titles GROUP BY Titles.[Year Published];
   the data in the Recordset.
Version           : WINDOWS:6.0
Platform          : WINDOWS
Issue type        : kbhowtoLast Reviewed: August 7, 1998