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,
APPROVED_FICO, APPROVED_RISK
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?
history84084
0
Newbie Poster
Recommended Answers
Jump to Postpost your entire code page for discussion
Jump to PostIf you bind data source to ComboBox well,
CAMPAIGN_ID = int.Parse(cboxMailRespSelProgram.SelectedValue.ToString());
Jump to PostSo, follow Serkan and post the whole code here.
All 9 Replies
serkan sendur
821
Postaholic
Banned
Ramy Mahrous
401
Postaholic
Featured Poster
history84084
0
Newbie Poster
Ramy Mahrous
401
Postaholic
Featured Poster
sknake
1,622
Senior Poster
Featured Poster
serkan sendur
821
Postaholic
Banned
sknake
1,622
Senior Poster
Featured Poster
serkan sendur
821
Postaholic
Banned
tatoba.shejal
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.