日期:2014-05-18  浏览次数:20772 次

SQL模糊查询的问题
在textbox1中输入要查询的“name”“job”“company”,如果知道name中的比如“张三”我怎么才能在textbox中输入‘张’就可以查询获得‘张三’呢?
在string str="select * from name='"+textbox1+"(接下来怎么写模糊查询的语句呢?)'";
谢谢大家了!

------解决方案--------------------
select * from TableName where name like '%张%'
------解决方案--------------------
select * from TableName where name like ( '% "+ textbox1.text + "%')
可能要转换下格式,如:select * from TableName where name like ( '%"+ convert.tostring(textbox1.text )+ "% ')
没有验证,你试试看
------解决方案--------------------

string sql = "select * from TableName where name like '%" +textbox1.text+ "%'"
ExecuteSql()
...

------解决方案--------------------
晕了。 
不懂..什么意思..上面回答的也不是你想要的结果