Retrieving Records from a Table
Records can be retrieved from a table through a recordset. The recordset can either be based directly on the table itself (as in Listing 16.5) or based on a SQL SELECT statement (such as "SELECT * FROM Customers"). In the following code a recordset is opened based on a SQL SELECT statement using the constant AdoNS::adCmdText. The recordset is opened read-only (AdoNS::adLockReadOnly) since the data will not be updated and this is more efficient. The connection string is specified in the same way as Listing 16.5.
_bstr_t bstrQuery(_T("Select * from Customers")); _variant_t varQuery(bstrQuery); hr = pRecordset->Open(varQuery, varConnection, AdoNS::adOpenStatic, AdoNS::adLockReadOnly, AdoNS::adCmdText);
A recordset ...
Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.