12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

464 Day 12<br />

■ If the KeyViolTableName property has been specified, any rows caus<strong>in</strong>g key violation<br />

errors will be placed <strong>in</strong> it.<br />

■ If the ChangedTableName property has been specified, TBatchMove will move updated<br />

or changed rows to it from the target table rather than discard them.<br />

TDataSource<br />

Module: DBTables Class ancestor: TComponent<br />

The TDataSource component is the l<strong>in</strong>k between data-aware controls and the TDataset<br />

components (TTable, TQuery, and TStoredProc). It’s what allows data-aware components to<br />

<strong>in</strong>teract with physical database objects.<br />

Data-aware controls reference a common TDataSource through their DataSource properties.<br />

It, <strong>in</strong> turn, references the TDataset that supplies them with data. The TDataset supplies data<br />

to the TDataSource, which is then passed to the data-aware controls. When data is modified<br />

<strong>in</strong> a data-aware control, the change is passed to the TDataSource, which then passes it to the<br />

TDataset.<br />

By abstract<strong>in</strong>g the data control level from the TDataset level, <strong>C++</strong>Builder allows the<br />

<strong>in</strong>teraction between the TDataset and data-aware controls to be more easily coord<strong>in</strong>ated. It<br />

enables you, for example, to change the TDataset for a number of components without<br />

chang<strong>in</strong>g them <strong>in</strong>dividually. That is, if you want to change the TDataset to which a form’s<br />

data-aware controls refer, you don’t have to change the controls themselves. Instead, you<br />

change the TDataset property of the TDataSource to which they refer. This three-tiered<br />

approach allows the access of a group of controls to a given TDataset to be more easily<br />

controlled.<br />

Table 12.19 lists the key properties, Table 12.20 lists the key methods, and Table 12.21 lists<br />

the key events for TDataSource.<br />

Table 12.19. TDataSource key properties.<br />

Property Description<br />

Autoedit Determ<strong>in</strong>es whether modify<strong>in</strong>g the contents of a data-aware control<br />

automatically starts Edit mode.<br />

Dataset References the TDataset that provides data to this TDataSource.<br />

Enabled Specifies whether the display of associated data controls is updated.<br />

State Returns the state of the l<strong>in</strong>ked TDataset component.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!