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.

460 Day 12<br />

Table 12.16. cont<strong>in</strong>ued<br />

Event Catalyst<br />

OnCalcFields Occurs when calculated fields need values.<br />

OnDeleteError Occurs when there is a problem delet<strong>in</strong>g a record.<br />

OnEditError Occurs when there is a problem edit<strong>in</strong>g a record.<br />

OnFilterRecord Occurs when filter<strong>in</strong>g is active and the TDataset needs a row.<br />

OnNewRecord Occurs when a new record is added to the TDataset.<br />

OnPostError Occurs when there is a problem post<strong>in</strong>g a record.<br />

OnUpdateError Occurs when there is a problem while apply<strong>in</strong>g cached updates.<br />

OnUpdateRecord Occurs for each row saved by a call to ApplyUpdates.<br />

Key Elements<br />

Use the DatabaseName property to specify the database you want to access. It po<strong>in</strong>ts to either<br />

a local, application-specific alias or one that you’ve def<strong>in</strong>ed us<strong>in</strong>g the Database Explorer or<br />

BDE Configuration utility.<br />

The StoredProcName property po<strong>in</strong>ts to the stored procedure on the server that you want to<br />

execute.<br />

The Params property enables you to specify parameters for the stored procedure. You can edit<br />

this <strong>in</strong>formation at design time us<strong>in</strong>g the <strong>C++</strong>Builder Object Inspector. If the <strong>in</strong>formation<br />

is available from the server, the Object Inspector will list the parameters that the stored<br />

procedure expects.<br />

NOTE<br />

You can set these parameters at runtime by assign<strong>in</strong>g values to the Params property. For<br />

example, you could use the follow<strong>in</strong>g code to assign the parameter named CustomerNumber<br />

for the stored procedure associated with the TStoredProc:<br />

StoredProc1->ParamByName(“CustomerNumber”)->AsStr<strong>in</strong>g = “123”;<br />

Note that stored procedure return values are accessed us<strong>in</strong>g the Params property, as well. That<br />

is, if you’ve def<strong>in</strong>ed an output parameter named Balance <strong>in</strong> the Params property, you can<br />

reference its return value us<strong>in</strong>g ParamByName(“Balance”)->AsFloat follow<strong>in</strong>g the execution<br />

of the procedure.<br />

If you <strong>in</strong>tend to return output parameters from a Sybase stored<br />

procedure that also returns a result set, you’ll need to call TStoredProc’s<br />

GetResults method <strong>in</strong> order to retrieve them. Normally, the

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

Saved successfully!

Ooh no, something went wrong!