The ExecuteReader() in SqlCommand Object sends the SQL statements to the Connection Object and populate a SqlDataReader Object based on the SQL statement. When the ExecuteReader method in SqlCommand Object execute , it will instantiate a SqlClient.SqlDataReader Object.
vb.net Dim reader As SqlDataReader = cmd.ExecuteReader
C# SqlDataReader reader = cmd.ExecuteReader();
The SqlDataReader Object is a stream-based , forward-only, read-only retrieval of query results from the Data Source, which do not update the data it contains. The SqlDataReader cannot be created directly from code, they can created only by calling the ExecuteReader method of a Command Object.
The following ASP.NET program execute sql statement and using ExecuteReader mthod.
Default.aspx
Untitled Page
Click the following links to see full source code