| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 531 人关注过本帖
标题:这样在两个表中查找
只看楼主 加入收藏
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
 问题点数:0 回复次数:4 
这样在两个表中查找

sql = "select * from replies where art_id = "&art_id&" order by issue_time ASC"

sql = "select * from topices where art_id = "&art_id&" order by issue_time ASC"

两个都可以显示

但是 sql = "select * from replies,topices where art_id = "&art_id&" order by issue_time ASC"

却不可以显示

错误是错误类型: Microsoft JET Database Engine (0x80004005) /ASP/replyTheme.asp, 第 40 行 就是RS.OPEN SQL,CNN 错误了

请问该怎么办???

2004-12-10 12:02
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

你两个表不联接一下?有两个表的时候字段名前要加表名。

sql = "select * from replies,topices where replies.art_id =topices.art_id and topices.art_id="&art_id&" order by topices.issue_time ASC"


天津网站建设 http://www./
2004-12-10 12:29
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 

谢谢拉


2004-12-10 12:30
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 

<% do until rs.eof response.write "<tr>" response.write "<td width='20%' bordercolor='#FF0000'>" response.write rs("author") response.write "</td>" response.write "<td width='80%' bordercolor='#FF0000'>" response.write rs("content") response.write "</td>" response.write "</tr>" rs.moveNext loop %>

上面的这些这么改?

显示不了

rs.("author")


2004-12-10 12:43
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 

<% response.write "<tr>" response.write "<td width='20%' bordercolor='#FF0000'>" response.write rs("topices.author") response.write "</td>" response.write "<td width='80%' bordercolor='#FF0000'>" response.write rs("topices.content") response.write "</td>" response.write "</tr>" rs.moveNext do until rs.eof response.write "<tr>" response.write "<td width='20%' bordercolor='#FF0000'>" response.write rs("replies.author") response.write "</td>" response.write "<td width='80%' bordercolor='#FF0000'>" response.write rs("replies.content") response.write "</td>" response.write "</tr>" rs.moveNext loop %>

我自己改成这个样子了

现在可以了

呵呵


2004-12-10 12:48
快速回复:这样在两个表中查找
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024887 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved