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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

466 Day 12<br />

Table 12.22 lists the key properties and Table 12.23 lists the key methods of the TUpdateSQL<br />

component. There are no key events for the TUpdateSQL component.<br />

Table 12.22. TUpdateSQL key properties.<br />

Property Description<br />

DeleteSQL Specifies the SQL to execute when a row is deleted.<br />

InsertSQL Specifies the SQL to execute when a row is added.<br />

ModifySQL Specifies the SQL to execute when a row is updated.<br />

Table 12.23. TUpdateSQL key methods.<br />

Method Function<br />

Apply Replaces parameters <strong>in</strong> and calls the SQL you specify (DeleteSQL,<br />

InsertSQL, or ModifySQL). Calls both SetParams and ExecSQL.<br />

ExecSQL Executes DeleteSQL, InsertSQL, or ModifySQL, as specified.<br />

SetParams Replaces the parameters <strong>in</strong> DeleteSQL, InsertSQL, or ModifySQL, as<br />

specified.<br />

Key Elements<br />

The InsertSQL, ModifySQL, and DeleteSQL properties provide the means of controll<strong>in</strong>g<br />

updates to TDatasets. These TDatasets can be TTables, TQuery result sets, or TStoredProc<br />

result sets. The SQL you specify can be a simple SQL INSERT, UPDATE, or DELETE statement.<br />

It can be a complex SQL query and can even consist of a call to a stored procedure. This<br />

flexibility gives you the control you need to update almost any type of result set.<br />

Tasks<br />

To make use of a TUpdateSQL component, follow these steps:<br />

1. Drop a TUpdateSQL component on a form and set its InsertSQL, DeleteSQL, and<br />

ModifySQL statements to update the database object(s) referenced by your TDataset.<br />

2. Set the TDataset’s UpdateObject property to po<strong>in</strong>t to your TUpdateSQL component.<br />

3. Set the TDataset’s CachedUpdates property to true.<br />

4. Call the ApplyUpdates command from with<strong>in</strong> your application when you want to<br />

<strong>in</strong>voke the SQL specified <strong>in</strong> the TUpdateSQL component.

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

Saved successfully!

Ooh no, something went wrong!