title: Is my logic correct? I'm trying to get data from combobox(dropdownlist) and use that data to search and display information in checkedlistbox
body: <p>I keep getting this error whenever I do the search:  Invalid column name 'datafromcombobox'</p>
  
  <p>I tried hardcode the data in my SQL query and it works.  Any idea what's wrong with my code?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>        string selectedMedication = cboMedicationType.SelectedItem.ToString();
  
          string strMedications = "SELECT medicationName FROM MEDICATION WHERE medicationType= (" + selectedMedication + ")";
          SqlCommand cmdMedications = new SqlCommand(strMedications, connection);
  
          connection.Open();
          SqlDataReader readMedications = cmdMedications.ExecuteReader();
  
          while (readMedications.Read())
          {
              string medicationVar = readMedications["medicationName"].ToString();
              clbMedication.Items.Add(medicationVar, true);
  
          }
          readMedications.Close();
          connection.Close();
  </code></pre>