Code Snippets

This section contains a large collection of code snippets using the SqlCommand object.

-
How to create a SqlCommand object
- How to read data from a SQL Server table using the ExecuteReader method
- How to use the Parameters.Add method
- How to Serialize a SqlCommand
- How to use SqlCommand in a Transaction
-
How to use the CommandText property
-
How to set the CommandTimeout property
-
How to use the BeginTransaction method
-
How to set the CommandType property
- How to pass a SqlCommand "by value"
- How to execute an SQL-statement using the ExecuteNonQuery method
-
How to use the Prepare method