真情大送分!等您来帮解答

endendlessless 2003-12-02 04:18:29
高分求一程序。具体如下:
表:product(id,pinpai,xinghao)
要求:字段pinpai对应于不同的字段xinghao
用程序如何控制。各位大吓帮忙啊。
例:id pinpai xinghao
1 1 a
2 1 b
3 5 c
4 9 d
5 5 m
要求显示结果如下:
1:a b
5: c m
9: d
大家帮帮我吧。
...全文
111 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tal 2003-12-04
  • 打赏
  • 举报
回复
同意 say1no2(海子)
shleo 2003-12-04
  • 打赏
  • 举报
回复
出错信息是什么
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
接着我上面的问题,我写的程序如下。大家看我为什么调不出来?
<%
set rs=server.createobject("ADODB.recordset")
sql="select distinct pinpai from product where leixing='喷墨打印机'"
rs.open sql,conn,1,1
%>
<table width=100% border=0>
<tr>
<td> </td>
</tr>
  <% do while not rs.eof %>
<% set cors=server.createobject("adodb.recordset")
 sql="select * from product where leixing='喷墨打印机' and pinpai=" & rs(0)
 set cors=conn.execute(sql) %>
<tr>
<td width="120"> <font color="#FFFFFF"><font color="#FF0000"><img src="images/dot.gif" width="13" height="13" align="absmiddle"></font></font><%=rs("pinpai")%></td>
</tr>
<tr>
<% Do While Not cors.EOF %>
<td> </td>
<td> <a href=javascript:winopen('product.asp?ProductNO=<%=cors("id")%>')><%=cors("xinghao")%></a> </td>
<% cors.movenext
loop
cors.close
    set cors=nothing
%>
</tr>
   <%
rs.movenext
    loop
rs.close
set rs=nothing
conn=close
set conn=nothing
   %>
</table>
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
真的非常感谢大家。
我现在才感觉到这个论坛的温暖 。
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
感谢xxrl(孔曰成仁,孟曰取E),谢谢你的帮忙。
我感觉海子的做法应该是比较可取的。但是我是
硬调不出来。调的时候老是虚拟内存不够。
我真不知怎么啦!
我真是太笨了。
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
我的错误信息是:
Active Server Pages 错误'asp 0113'
脚本超时。
请问这个错误应如何解决呢?
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
我和程序有没有错啊!
endendlessless 2003-12-04
  • 打赏
  • 举报
回复
没有出错信息。只是运行很慢。
看不到网页。
所以我也不知错在哪里?
shleo 2003-12-03
  • 打赏
  • 举报
回复
rs(0)应该是选取的第一个字段
而不是数据库表的第一个字段把
xxrl 2003-12-03
  • 打赏
  • 举报
回复
不好意思
xxrl 2003-12-03
  • 打赏
  • 举报
回复
帮你问了一下,呵呵,我搞不定,就跑到数据库那里问了,呵呵
http://expert.csdn.net/Expert/topic/2519/2519498.xml?temp=.5557367
monkeys 2003-12-02
  • 打赏
  • 举报
回复
对,rs(0)=rs("id")

但是,rs(0)的速度比rs("id")的读取快
endendlessless 2003-12-02
  • 打赏
  • 举报
回复
那岂不是我的id了。
monkeys 2003-12-02
  • 打赏
  • 举报
回复
不一样

rs(0)是数据表的第一个字段
而在你的表中pinpai却不是第一个字段
endendlessless 2003-12-02
  • 打赏
  • 举报
回复
to:saylno2(海子)
我知道你理解了我的想法。我正在调试我的程序。
但我想问一下:
set cors=conn.execute("select xinghao from product where pinpai=" & rs(0))
是否等于
set cors=conn.execute("select xinghao from product where pinpai=" & rs("pinpai"))
呢?
如果是的话,我怎调试不出来。如果不是的话。望告知。
我调试出来的话。马上给分。在此我先谢过了。
elex 2003-12-02
  • 打赏
  • 举报
回复
distinct不行

同意say1no2(海子)
endendlessless 2003-12-02
  • 打赏
  • 举报
回复
distinct我当然知道了。但我调不出我上面所说的效果来。
我觉得要用到两层循环。
say1no2 2003-12-02
  • 打赏
  • 举报
回复
错了,要想实现你的效果要分两步走
set rs = conn.execute("select distinct pinpai from product")
do while not rs.eof
set cors = conn.execute("select xinghao from product where pinpai=" & rs(0))
response.write rs(0) & ":"
do while not cors.eof
response.writre cors(0) & " "
cors.movenext
loop
response.write "<br>"
rs.movenext
loop
swich 2003-12-02
  • 打赏
  • 举报
回复
用distinct
say1no2 2003-12-02
  • 打赏
  • 举报
回复
select distinct pinpai, xinghao from product
加载更多回复(2)

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧