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 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.