Differents between ExecuteReader, ExecuteNonQuery & ExecuteScalar

ExecuteReader : Use for accessing data. It provides a forward-only, read-only, connected recordset.

ExecuteNonQuery : Use for data manipulation, such as Insert, Update, Delete.

ExecuteScalar : Use for retriving 1 row 1 col. value.,
i.e. Single value.
eg: for retriving aggregate function.
It is faster than other ways of retriving a single value from DB.

Comments

Popular posts from this blog

SOLID Principles with C#

MVC Request Execution Stages - Life Cycle

Page Life Cycle in ASP.NET

Abstract Class and An Interface

Send Email using Gmail SMTP server - ASP.NET

Introduction to ASP.Net MVC

Variable Value in Top Statement

ASP.NET MVC Version History

How to Edit More than 200 Rows in SQL Server 2008