0

我正在逐页查询数据库中的一些练习。页面信息包含在练习的描述中。所以,ExerciseDescription 是这样的:

p. 72. do this and that...
p.72. do this and the other thing...
p. 70. this is yet another exercise...

所以为了适应p之间的空间不足。查询的实际数字如下:

dbExerRecordSet.Filter = "ChapterID=100196 AND ExerciseType='School' AND (ExerciseDescription LIKE 'p. 72*' OR ExerciseDescription LIKE 'p.72*')"

但我收到了这个错误:

ADODB.Recordset<br/><b>Description:</b> Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

所以我认为点字符有问题,因此我将查询转换为:

dbExerRecordSet.Filter = "ChapterID=100196 AND ExerciseType='School' AND (ExerciseDescription LIKE 'p[.] 72*' OR ExerciseDescription LIKE 'p[.]72*')"

但我仍然得到同样的错误。这很奇怪。如果我删除 OR 和之后的所有内容,我不会收到任何错误。如果我将 OR 更改为 AND 我没有错误(当然也没有找到任何练习)。

到底是怎么回事?

提前致谢。

编辑

dbExerRecordSet.Filter = "ChapterID=100196 AND ExerciseType='School' AND (ExerciseDescription LIKE 'p[.]*72*')"

上面没有抛出错误,但也没有找到第 72 页中的两个练习。

edit2:星号不是问题。我把它换成 %,它做的事情完全一样

4

1 回答 1

0

ADO%*使用LIKE通配符。

于 2013-11-07T10:13:00.990 回答