4
Answers

comboBox- data bound item

Photo of Violeta Popa

Violeta Popa

12y
1.5k
1
Hi :) I have a comboBox and I used the option Use Data Bound Items. I've set the Data Source, the Display Member and Value Member, but I need the comboBox to contain only the clients whose name begins with 'RO'. I've tried to use a Query but it's not correct and I don't know how to do it. Here's the query used:

SELECT denumire FROM dbo.client WHERE denumire.Substring(1,2)='RO'. I know that i should use parameters but i don't know how. Some help?

Answers (4)

0
Photo of Vulpes
NA 98.3k 1.5m 12y
Try:

SELECT denumire FROM dbo.client WHERE UPPER(SUBSTRING(denumire, 1, 2)) = 'RO'
Accepted
0
Photo of Violeta Popa
NA 137 110.7k 12y
Thanks, it worked. I have one more question, using DataBound and Query creates a Fillby ToolStrip and the comboBox is filled only when I click on the Fillby Tool. Is there a way to fill automatically the combobox? when form loads or something like that?
0
Photo of Violeta Popa
NA 137 110.7k 12y
thanks, but still doesn't work, now doesn't display anything :(
0
Photo of Vishal Gilbile
NA 13.9k 2.9m 12y
Hello Friend,
            Just replace your query with the following

SELECT denumire FROM dbo.client WHERE denumire like 'RO'.


Hope that solves your problem.


With Regards,
Vishal Gilbile