asp多表查询问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 18:13:24
本人有二个表想实现多表查询但一直出不来请高手帮忙!
第一个表attendee
atten website ID
. . 1
. . 2
. . .
第二个表nexus
expoID attenID ID
. . 1
. . 2
. . .
要实现的功能是输入expoID经过表nexus在第一个表中查出atten
我的语句是这样子但是提示错误"至少一个参数没有被指定值"
set rs=server.createobject("adodb.recordset")
sql="select attendee.atten, attendee.website from nexus as n1 inner join attendee as a1 on n1.attenID=a1.ID where n1.expoID= '"& expoID &"'"
rs.open sql,cot,3,2
还请高手帮忙
我试了试出现这个问题:"标准表达式中数据类型不匹配"。是我建数据库的问题吗?这个数据库有什么要求吗?比如说主键什么的.
还是出不来 又变成了"至少一个参数没有被指定值。"
不如我把原文件给你帮我改一下发到我邮箱好吗?
http://www.ekaproducts.com/datebase.rar
我的邮箱是nbliujunli@126.com
滴水之恩定当涌泉来报

sql="select atten from attendee where id in (select attenID from nexus where expoID='"& expoID &"')"

sql="select a1.atten, a1.website from nexus as n1 inner join attendee as a1 on n1.attenID=a1.ID where n1.expoID= '"& expoID &"'"

相关联的字段类型必须一样,如果不一样要进行转换,比如
n1.attenID=a1.ID 这两个字段类型要相同,或强制转换
cstr(n1.attenID)=cstr(a1.ID)