ASP查询ACCESS不同表问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 08:11:01
我想在ASP页面的一张表格显示数据库2张不同表的多个属性,比如 server表里几个属性,yonghu表里2个属性,让他们一起显示。但是我的代码,server表里几个属性显示正常,但是yonghu表里2个属性不能显示,提示:(ADODB.Recordset '800a0cc1' 在对应所需名称或序数的集合中,未找到项目。 \list.asp, line 42)。我的意思是让这2张表ID相同的那条记录一起显示。 代码我贴出来,各位大侠帮帮忙。 万分感谢...

<!--#include file="conn.asp"-->
<%
dim sql
dim rs
sql="select server.ID,server.question,server.mine,server.count,server.keyword,server.questiontime,server.answertime,server.content,server.datetime,server.state,yonghu.ID,yonghu.drid,yonghu.mima from server,yonghu where yonghu.id="&request("id")
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<link href="txt.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<table width="450" border="0" align="c

select server.ID,server.question,server.mine,server.count,server.keyword,server.questiontime,server.answertime,server.content,server.datetime,server.state,yonghu.ID,yonghu.drid,yonghu.mima from server,yonghu where yonghu.id=server.id
只有这样每一个相同的id才能对应!或者:

select * from yonghu left join server on yonghu.id=server.id

当然也可以:
select * from server right join yonghu on server.id=yonghu.id

以上三种取出结果并不一定相同,要看你的数据表结构和你……到底要干什么……用!

<!--#include file="../../inc/conn.asp"-->
<!--#include file="../check.asp"-->
<!--#include file="cook.asp"-->
<LINK href="../../style.css" type=text/css rel=stylesheet>

<%
if request.form("Submit")="驳回修改" then
id=request("id")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("update mission set state=-1 where project_id="&id(i)&"&qu