2

What is the difference between:

myCommand.Parameters.AddWithValue("search", "% " + myValue + " %");

and:

myCommand.Parameters.AddWithValue("@search", "% " + myValue + " %");

The difference above is with and without the @ symbol. Does it do anything special?

cdub
  • 24,555
  • 57
  • 174
  • 303

2 Answers2

4

You need to use the variant with the '@'. The '@' symbol signifies a variable or a stored procedure / function parameter.

tom
  • 18,953
  • 4
  • 35
  • 35
0

in sql stored procs or functions you must specify parameters name by '@' sign at the beginning of their name

kazem
  • 3,671
  • 1
  • 22
  • 21