title: Incorrect syntax near Parameter
body: <p>I'm using Visual Studio 2013, C# and SQL Server database.</p>
  
  <p>The T-SQL command works just fine if I replace the parameter with a concrete value.</p>
  
  <p>I get this error on the last line of code:</p>
  
  <blockquote>
    <p>Incorrect syntax near '@Collection1'.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>string myCommandString = "select Name, Collection, Text from List_Card @Collection1";
  SqlConnection myConnection = new SqlConnection(connectionstring);
  
  SqlCommand myCommand = new SqlCommand(myCommandString, myConnection);
  SqlDataAdapter myydata = new SqlDataAdapter();
  
  if (comboBox1.Text != "")
  {
      string1 = "where Collection IN (select Shortcut from Collections where Collection Like '" + comboBox1.Text + "')";
  }
  else 
  {
      string1 = ""; 
  }
  
  myCommand.Parameters.Add(new SqlParameter("@Collection1", string1));
  myydata.SelectCommand = myCommand;
  
  myConnection.Open();
  DataTable myytab = new DataTable();
  myydata.Fill(myytab);
  </code></pre>