You decide to use named parameters in a SqlCommand object in order to execute SQL queries on a database. You have a parameter named “CustomerName”. How do you refer to it within the SQL query text in the SqlCommand object?
[Visual Basic]
Public Sub CreateSqlParameter()
' Create a parameter of SqlDbType.Int (Int32).
Dim p1 As SqlParameter = New SqlParameter("@CategoryID", 1)
' Create a parameter of SqlDbType.NVarChar (String).
Dim p2 As SqlParameter = New SqlParameter("@Description", "Soft drinks, coffees, teas, beers, and ales")
End Sub 'CreateSqlParameter
[C#]
public void CreateSqlParameter()
{
// Create a parameter of SqlDbType.Int (Int32).
SqlParameter p1 = new SqlParameter("@CategoryID", 1);
// Create a parameter of SqlDbType.NVarChar (String).
SqlParameter p2 = new SqlParameter("@Description", "Soft drinks, coffees, teas, beers, and ales");
}