meku卡包:ASP中的数组问题

来源:百度文库 编辑:高校问答 时间:2024/04/29 01:24:47
假设有这样一个数组: arrA
arrA的值是: 10001,10002,10003,10004
有如下语句:
Set Rs = Conn.Execute("Select Id from UserInformation where UserId in ("&aarA&")")
这一句话的意思是在用户库中检索用户ID的范围在数组arrA中的所有用户.
问题是:如果检索用户ID的范围不在数组arrA范围中的呢?
Set Rs = Conn.Execute("Select Id from UserInformation where UserId Not in ("&aarA&")")
曾试过如上语句,但不能实现,求助,谢谢
Set Rs = Conn.Execute("Select Id from UserInformation where UserId Not in ("&aarA&")")
达不到预期的目的,唉,在数组中的信息还是被检索出来了,郁闷,盼答,谢谢

这一句:

Set Rs = Conn.Execute("Select Id from UserInformation where UserId Not in ("&aarA&")")

是对的阿,怎么不能实现呢,报什么错?结果是什么?

可以在代码中Response.Write一下这条语句,然后放到数据库中执行一下,看看结果.

能不能用个判断语句呢?判断一下用户的ID在不在ARRA中,如果不在那么。。。如果在那么。。。

你用子查询试试吧
Select Id from UserInformation where UserId Not in (Select Id from UserInformation where UserId in ("&aarA&"))