Contents page 
  Previous | Next 
 

Tutorial 8 - Database access


Contents

Basics

Introduction
Connecting to Data sources at design-time
Connecting to Data sources at run-time

Extended Functionality

Single record
Summary grouping data

Events

The OnProcessRecord event


Basics

Introduction

Connecting a TeeChart control to Databases can be done at design-time using the Chart Editor and at run-time with few lines of code. You should use the TDBChart component as, as the name suggests, this TeeChart component supports data access. TDBChart installs on the Data Controls section of the Component Palette. TDBChart inherits all TChart properties and methods, the key difference being that it also includes access to Borland's Database Engine thus increasing the size of projects compiled with this component. For this reason we recommend that you use the TChart component unless you wish to connect directly to data sources.

TeeChart connects to all Borland's TData components including TTable, TQuery and TClientDataset. When connecting to Tables or Queries it is not necessary to use the TDataset component as TeeChart will make the connection directly.

Any Series can be connected to tables or queries using the Chart Editor. Every Series can be connected to the same or different table or query in the same or different database.

This design gives you total flexibility on how you connect Charts to databases, as you aren't restricted to only one database or to only one table or query.

Data is also retrieved at design-time so you see the actual data during development.

Connecting to A TData component at design-time

The following steps assume you have put either a TTable, TQuery or TClientDataset on your Form. For this example you could connect the TTable to the TeeChart Pro Database, installed as an ODBC v3 DSN, during the installation of TeeChart Pro and select the Employee Table.

At design-time, the steps necessary to connect a Series to a Datasource are: