在ADODB下WHERE子句使用多值查阅字段(using a multi-value Lookup

2019-10-20 04:57发布

你如何基于Access数据库中的多值查找字段中选择行?

下面的ASP代码返回使用多数据列时没有值:

<%
Dim Contractors
Dim Contractors_cmd
Dim Contractors_numRows

Set Contractors_cmd = Server.CreateObject ("ADODB.Command")
Contractors_cmd.ActiveConnection = MM_Listings_STRING
Contractors_cmd.CommandText = "SELECT * FROM Contractor WHERE UserStatus = 'Active' AND     AgentID= "& Session("AgentID") 
Contractors_cmd.Prepared = true

Set Contractors = Contractors_cmd.Execute
Contractors_numRows = 0
%>

Answer 1:

如果UserStatus是多值查找字段,则该字段的各个值(S)通过访问UserStatus.Value所以你需要使用

... WHERE UserStatus.Value = 'Active' ...


文章来源: using a multi-value Lookup field in a WHERE clause under ADODB