---
title: "ExecuteNonQuery, ExecuteReader and ExecuteScalar Methods in C#"  
description: "ExecuteNonQuery Method:This method is commonly used for update, insert and delete statements, where the only returned value is the number of record af"  
author: "AVADHESH PATEL"  
published: 2013-01-17  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/430/executenonquery-executereader-and-executescalar-methods-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# ExecuteNonQuery, ExecuteReader and ExecuteScalar Methods in C#

##### ExecuteNonQuery Method:

This method is commonly used for update, [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) and delete statements, where the only returned value is the number of record affected.

[Namespace](https://www.mindstick.com/articles/12552/namespace): System.Data.SqlClient

[Assembly](https://www.mindstick.com/articles/25/global-assembly-cache): System.Data (in System.Data.dll)

[Return Value](https://www.mindstick.com/forum/33675/how-to-convert-return-value-of-abmulivaluecopylabelatindex-into-nsstring-in-ios) Type: System.Int32

[ExecuteReader Method](https://www.mindstick.com/interview/23359/explain-the-executereader-method-in-ado-dot-net):

This method executes the [command](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) and returns a typed data reader object, depending on the [provider](https://www.mindstick.com/interview/22953/explain-content-provider-in-android) is used. The object returned can be used to iterate through the record(s) returned.

Namespace: System.Data.SqlClient

Assembly: System.Data (in System.Data.dll)

Return Value Type: System.Data.SqlClient.SqlDataReader

[ExecuteScalar](https://www.mindstick.com/forum/157165/what-is-the-difference-between-executescalar-executereader-and-executenonquery) Method:

[Execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) the command and return a single value. On many occasions, it is necessary to return a single result from a SQL statement, such as the count of [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) in a given table, or the current data time of the server.

Namespace: System.Data.SqlClient

Assembly: System.Data (in System.Data.dll)

Return Value Type: System.Object

---

Original Source: https://www.mindstick.com/blog/430/executenonquery-executereader-and-executescalar-methods-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
