combobox usage with sql statement

I have datagridview , combobox. And I completely set the datasource. I addet some items into combobox. I want to execute the sql statement when I click the items in combobox but it does not work.

sql statement for fillby :

select * from table 1 where abc like ' " &combobox1& " '

and the click event of combobox1 is :

me.table1tableadapter.fillby(me.dataset.table1)

it doesn't work.. How can I do this ?

[467 byte] By [jacabo2006] at [2007-12-24]
# 1

what happens when "it doesn't work"?

you may wish to try this query:

"select * from table 1 where abc like '%" &combobox1.Text & "%' "

ahmedilyas at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2

For sql statements consider using parameter collections on the command - by simply concatenating text to form a string you are opening yourself up to the potential of a SQL injection attack.

If you dont know what this is do a simple web search on "SQL injection attack"

spotty at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 3
just to add, or even better, used Stored Procedures - faster and securer ;-)
ahmedilyas at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...