I am trying to implement a search on a SQL database using a textbox and a dropdownlist. The sql command has two parameters in it that effectively says "SELECT * FROM myTable WHERE @Param1 = @Param2" where Param1 is being set from the drop down list that is a list of the table headers and Param2 is the string in the textbox. This is not working. It compiles but does not return any results.

If I hard code Param1 or the column header in and just leave Param2 the search works fine. When stepping through the code both lines that assign a value to the parameters in the SqlCommand object are assigning the correct values but the commandtext property still shows the parameters as @Param1 and @Param2.

Is there something inherently wrong with this.