Vbscript ASP LDAP查询中的多个where子句存在一个或多个问题

Vbscript ASP LDAP查询中的多个where子句存在一个或多个问题,vbscript,asp-classic,active-directory,Vbscript,Asp Classic,Active Directory,我有一个用ASP编写的脚本,它将列出未被禁用的Active Directory用户。我的查询如下(但这里我使用了一个假DN): objCom.CommandText=“从'LDAP://OU=Users,DC=example,DC=internal'中选择givenName,sn,mail,telephonenumber,mobile,description,sAMAccountName,cn,UserAccountControl,其中UserAccountControl 514或其中UserA

我有一个用ASP编写的脚本,它将列出未被禁用的Active Directory用户。我的查询如下(但这里我使用了一个假DN):

objCom.CommandText=“从'LDAP://OU=Users,DC=example,DC=internal'中选择givenName,sn,mail,telephonenumber,mobile,description,sAMAccountName,cn,UserAccountControl,其中UserAccountControl 514或其中UserAccountControl 2和sAMAccountName='*'按cn ASC排序”
问题是,当我只有one where语句时,它工作正常并输出用户列表,但当我同时拥有这两个语句时,将返回以下消息

提供程序错误“80040e14”

处理命令期间发生一个或多个错误

/ldap.asp,第25行


不知道问题是什么,但我认为,因为它与one-WHERE语句一起工作,所以它与查询有关。您能为我解释一下吗?

多个条件的SQL语法是使用适当的布尔运算符(
,通常,尽管其他条件也可能)将条件串在一起,根据需要使用括号。不要重复
WHERE
子句:这与重复
SELECT
FROM
中的
一样错误

SELECT givenName, sn, mail, telephonenumber, mobile, description, sAMAccountName, cn, UserAccountControl 
FROM 'LDAP://OU=Users,DC=example,DC=internal' 
WHERE UserAccountControl <> 514 OR UserAccountControl <> 2 AND sAMAccountname ='*' 
ORDER by cn ASC
选择givenName、序列号、邮件、电话号码、手机、说明、sAMAccountName、cn、UserAccountControl
来自“LDAP://OU=Users,DC=example,DC=internal”
其中UserAccountControl 514或UserAccountControl 2和sAMAccountname='*'
中国航空航天局订购

字符串中有一个输入错误<代码>。。。在UserAccountControl 514或UserAccountControl 2中,有两个where在那里。
SELECT givenName, sn, mail, telephonenumber, mobile, description, sAMAccountName, cn, UserAccountControl 
FROM 'LDAP://OU=Users,DC=example,DC=internal' 
WHERE UserAccountControl <> 514 OR UserAccountControl <> 2 AND sAMAccountname ='*' 
ORDER by cn ASC