使用Like运算符获取数据时出现问题 [英] Problem getting data using Like Operator

查看:94
本文介绍了使用Like运算符获取数据时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试使用like运算符从Access数据库中获取数据.例如,我的ProducID包含NoteBook,Notes等.使用类似运算符,如果用户键入No等,我希望将它们全部显示出来.
Like运算符没有给出任何错误,但仅在我放入完整的NoteBook时才显示记录(不显示Notes偏离路线)

请注意,我要在数据集中使用查询.


请告知如何修复.
谢谢

Hi,
I am trying to get data from my Access database using like operator. For example my ProducID contains NoteBook, Notes etc. Using like operator, I want to get them all shown if user types No etc.
Like operator did not give any errors but it only shows record when I put full NoteBook (does not show for Notes offcourse)

Please note I want to use the query in dataset.


Please advise how to fix it.
Thanks

推荐答案

我不确定使用Access,但是我在SQL Server中这样做:

Im not sure with Access, but I do it in SQL Server like this:

SELECT * FROM [TABLENAME] WHERE No = ''%'' + @No + ''%''



最好的问候,
爱德华(Eduard)



Best regards,
Eduard


这可能很明显,但是您是否输入了"*" ...就像"Note *"
This may be obvious but did you put in the "*" ... LIKE "Note*"


您没有显示您正在使用的查询,所以这只是一个猜测,但请确保它是这样的

You didn''t show the query you were using so this is just a guess, but make sure it is like this

select ... from table where column LIKE ''Note%''



%是通配符,它​​将找到所有以字符"Note"开头的内容,因此它将与Notebook和Notes相匹配



The % is a wildcard and will find anything that begins with the characters ''Note'' so it will match Notebook and Notes


这篇关于使用Like运算符获取数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆