title: Getting "Invalid Column Name " Sql Exception in the following code
body: <p>I am trying to pass both Column name and the Value to be checked in the code at runtime. However I am getting an "Invalid Column Name   " exception.
  The code is as follows :</p>
  
  <pre><code>string temp = TextBox1.Text.ToString();
  SqlConnection con = new SqlConnection("data source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Sagar\\Documents\\Test.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
  SqlCommand com = new SqlCommand("Select * from Employee Where @field = Sagar", con);
  com.Parameters.AddWithValue("@field", DropDownList1.SelectedValue.ToString());
  //com.Parameters.AddWithValue("@value", temp);
  SqlDataAdapter da = new SqlDataAdapter(com);
  con.Open();
  SqlDataReader reader = com.ExecuteReader();
  GridView1.DataSource = reader;
  GridView1.DataBind();
  </code></pre>