I am trying to query my SQL Server database to populate a dataGridView. The user clicks on an item in a comboBox to select a 'program' to view. The where statement in the quers used the Text property from the comboBox. The code is:
SELECT CAMPAIGN_ID, CREDIT_GRADE_PRE, SUB_GRADE, APR, ANNUAL_FEE, CREDIT_LINE, SEGMENT, MAIL_CELL, MAILED, RESPONDED, APPROVED,
FROM [PROD_Mail Response]
WHERE (CAMPAIGN_ID = cboxMailRespSelProgram.Text)
The SQL query apparently does not find the comboBox.Text string and gives the following error message.
The multi-part identifier "cboxMailRespSelProgram.Text" could not be bound. I have already tried adding '.toString()' to the cboxMail... part without success. Suggestions?