using System.Data.SqlClient; using System.Data; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT * FROM Customers WHERE Country = @country"; cmd.Parameters.Add("@country", SqlDbType.NVarChar, 15).Value = "USA";
using System.Data.OracleClient; OracleCommand cmd = new OracleCommand(); cmd.CommandText = "SELECT * FROM Employees WHERE LastName = :lastName"; cmd.Parameters.Add("lastName", "Smith");In this example, a parameter named "lastName" is added to the OracleCommand object with the value "Smith". The parameter name does not include the '@' symbol and instead uses a ':' symbol. This example uses the System.Data.OracleClient package library. In both examples, the AddParameter method is used to add a parameter with a name and a value to the command object. The type and length of the parameter can also be specified if necessary.