using System.Data.SqlClient; ... SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT * FROM Customers WHERE Country = @Country"; cmd.Parameters.Add("@Country", SqlDbType.NVarChar).Value = "USA";
using System.Data.SqlClient; ... SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT * FROM Products WHERE Category = @Category AND IsActive = @IsActive"; cmd.Parameters.Add("@Category", SqlDbType.NVarChar).Value = "Electronics"; cmd.Parameters.Add("@IsActive", SqlDbType.Bit).Value = true;In this example, two parameters with the names "@Category" and "@IsActive" are added to a SqlCommand object. Their values are used to filter the results of a SQL query. The package library for System AddParameter is System.Data.SqlClient, which is included in the .NET Framework library.