SQL字符串不喜欢Like?

编程入门 行业动态 更新时间:2024-10-27 10:33:04
本文介绍了SQL字符串不喜欢Like?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试从Access数据库中获取特定记录.

I'm trying to get specific records from an Access database.

该字符串在Access数据库中有效,但在我的VB程序中无效.

The string works in the access database but not in my VB program.

从[Joist Table]中选择[Join Table].*大小与"*#LH *"类似按大小排序,和弦;

SELECT [Joist Table].* FROM [Joist Table] WHERE size Like "*#LH*" ORDER BY size,chord;

如果我使用第一个字符串,则可以使用,但不能使用第二个字符串.我添加了quot变量,以查看使用双引号是否存在问题,但这似乎没有任何影响.我也删除了ORDER BY参数,看是否是问题所在.

If I use the first string, it works, but not the second string. I added the quot variable to see if there were problems using double quotes, but that didn't seem to affect anything. I also removed the ORDER BY parameters too to see if that was the problem.

dsString =选择[Join Table].*从[Joist Table]的WHERE size像" *#LH *";"

dsString = "SELECT [Joist Table].* FROM [Joist Table] WHERE size Like ""*#LH*"";"

也没有运气.

关于如何使LIKE参数起作用的任何想法?

Any idea on how to get the LIKE parameter to work?

推荐答案

Microsoft Access SQL默认情况下使用其他通配符,即星号(*).使用OLEDB时,您应该改用百分号(%).另一种选择是使用未记录的关键字ALIKE代替LIKE(如果您想 在Access中使用百分号). Microsoft Access SQL uses a different wild-card character by default, which is the asterisk (*). When using OLEDB you should use the percent sign (%)instead. The other option is to use the undocumented keyword ALIKE instead of LIKE (if you want to use the percent sign in Access).

更多推荐

SQL字符串不喜欢Like?

本文发布于:2023-10-28 05:34:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不喜欢   字符串   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!