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.

456 Day 12<br />

NOTE<br />

For server tables, the SQL must<br />

■ Use Local SQL syntax only<br />

■ Involve only one table<br />

■ Not conta<strong>in</strong> aggregate functions<br />

The TLiveQuery component that you can obta<strong>in</strong> at http://<br />

www.mcp.com/sams/codecenter.html provides an alternative method<br />

of acquir<strong>in</strong>g updatable result sets from database servers. Basically, it<br />

creates and opens a temporary view on your server that you may then<br />

update as though it were a table. The updates you can make to this<br />

“live” result set are limited only by the restrictions your server places<br />

on updatable views.<br />

The First method moves to the top of the TDataset, and the Last method moves to the<br />

bottom. The Prior and Next methods move to the previous and next rows, respectively. You<br />

use the MoveBy method to move a number of rows forward or backward from the current row.<br />

Use the Bof property to determ<strong>in</strong>e whether the TDataset cursor is at its beg<strong>in</strong>n<strong>in</strong>g. Use the<br />

Eof property to determ<strong>in</strong>e whether the cursor has reached the TDataset’s end. These two<br />

properties can be useful <strong>in</strong> loop<strong>in</strong>g through the rows <strong>in</strong> a TDataset.<br />

WARNING<br />

Be careful that you don’t make bad assumptions about the Bof and Eof<br />

properties. You can’t assume that Bof will be true just because you’re<br />

on the first row of a query result set, nor can you assume that Eof will<br />

be true when you’re on the last row of a result set. Typically, an<br />

additional Prior or Next is required to set Bof or Eof to true. For<br />

example, the sequence First, Next, Prior won’t reset Bof to true, but<br />

First, Next, Prior, Prior will. Note that Bof is true immediately after<br />

you open a query or call the First method, and Eof is true immediately<br />

after you call the Last method.<br />

The Append and Insert methods are used to add blank rows to a TDataset. Append adds a<br />

record to the end of the TDataset, whereas Insert adds it at the current cursor position. Along<br />

these same l<strong>in</strong>es, the AppendRecord and InsertRecord methods are used to add non-blank<br />

rows to a TDataset us<strong>in</strong>g a supplied set of field values.

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

Saved successfully!

Ooh no, something went wrong!