Junior From PDF ADO.NET ADO.NET

What is the significance of the SqlDataReader? The SqlDataReader is used to retrieve data from the database in a forward-only and read-only manner. It is more efficient than a DataSet when you need to retrieve a large

mount of data quickly and do not need to modify the data. It requires an open connection to

the database and reads data sequentially, one row at a time.

Example:

SqlCommand command = new SqlCommand("SELECT CustomerName FROM

Customers", connection);

SqlDataReader reader = command.ExecuteReader();

while (reader.Read())

{

Console.WriteLine(reader["CustomerName"]);

}

reader.Close();

More from ADO.NET Core Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details