Retrieving Data by Using SqlCeDataReader

Data can be retrieved from a SQL Server CE database by using the SqlCeDataReader class. The SqlCeDataReader class provides fast, forward-only access to rows of data.

The steps to retrieve data by using the SqlCeDataReader are similar to the steps required to run the INSERT SQL command:

1.
We create an instance of the SqlCeConnection. The SqlCeDataReader will use this connection to retrieve the requested data rows.
2.
A SqlCeCommand object should be created with the appropriate SELECT statement.
3.
Set the command's command type, and call the SqlCeCommand.ExecuteReader method.

The ExecuteReader method executes the command text against the database by using the SqlCeConnection. A SqlCeDataReader that will ...

Get Microsoft® .NET Compact Framework Kick Start now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.