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?

  1. “?CustomerName”

  2. “@CustomerName”

  3. “%CustomerName”

  4. “#CustomerName”


Correct Option: B

AI Explanation

To refer to a named parameter within the SQL query text in a SqlCommand object, you would use the "@" symbol followed by the parameter name.

So the correct way to refer to the parameter named "CustomerName" in the SQL query text would be:

B. "@CustomerName"

Find more quizzes: