# SqlCommand

*noun*

say it: **“ESS-kyoo-EL kuh-MAND”** **/ˌɛs kjuː ˈɛl kəˈmænd/**

The ADO.NET class that holds one SQL statement and runs it on an open connection.

## What is **SqlCommand** in C#?

**SqlCommand** — The ADO.NET object that holds one SQL statement and runs it on an open connection. `ExecuteScalar` returns one value, `ExecuteReader` returns rows, and `ExecuteNonQuery` runs an INSERT, UPDATE or DELETE.

```csharp
using SqlCommand command = new("SELECT COUNT(*) FROM Products", connection);
int count = (int)command.ExecuteScalar();
Console.WriteLine(count); // 77
```

## In a sentence

- “I put the query and its @id parameter in a **SqlCommand** and called ExecuteReader.”

Level: Journeyman · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=3)

Updated: October 28, 2026

Source: https://www.ask-codey.com/glossary/sqlcommand
