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.

<strong>C++</strong>Builder Database Architecture<br />

The Delete method deletes the row at the current cursor position. The Edit method allows<br />

you to modify rows <strong>in</strong> the TDataset, plac<strong>in</strong>g the TDataset <strong>in</strong> dsEdit mode. The Post method<br />

saves these changes to the database, whereas Cancel discards them.<br />

See the previous discussion on the Table component for <strong>in</strong>formation on other TDatasetbased<br />

properties, methods, and events.<br />

TStoredProc<br />

Module: DBTables Class ancestor: TDBDataSet<br />

Like TTable and TQuery, TStoredProc is a direct descendant of the DBDataSet class and an<br />

<strong>in</strong>direct descendant of the TDataset class. This means that, <strong>in</strong> addition to the methods,<br />

properties, and events def<strong>in</strong>ed by the class itself, TStoredProc <strong>in</strong>herits several class elements<br />

from the DBDataSet class. This establishes a lot of common ground between the three<br />

TDataset-based components, TTable, TQuery, and TStoredProc.<br />

You use the TStoredProc component to execute stored procedures from with<strong>in</strong> your<br />

<strong>C++</strong>Builder applications. A stored procedure is a compiled set of SQL statements executed<br />

as a s<strong>in</strong>gle program. TStoredProc enables you to <strong>in</strong>teract with the result sets returned by these<br />

stored procedures.<br />

Table 12.<strong>14</strong> lists the key properties, Table 12.15 lists the key methods, and Table 12.16 lists<br />

the key events for the TStoredProc component.<br />

Table 12.<strong>14</strong>. TStoredProc key properties.<br />

Property Description<br />

Active Toggles whether the TDataset is open.<br />

AutoCalcFields Determ<strong>in</strong>es how calculated fields are calculated.<br />

Bof Reflects whether the TDataset is at its beg<strong>in</strong>n<strong>in</strong>g.<br />

CachedUpdates Toggles whether updates are cached.<br />

Database Identifies the TDatabase <strong>in</strong> use by the TDataset.<br />

DatabaseName Names the alias used to connect to the database.<br />

Eof Reflects whether the TDataset is at its end.<br />

FieldCount Returns the number of fields <strong>in</strong> the TDataset.<br />

FieldDefs Lists important <strong>in</strong>formation about fields <strong>in</strong> the TDataset.<br />

Fields Returns a specific field from the TDataset. (Requires an <strong>in</strong>dex<br />

parameter to be passed <strong>in</strong>.)<br />

457<br />

cont<strong>in</strong>ues<br />

12

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

Saved successfully!

Ooh no, something went wrong!