注册 登录
编程论坛 ASP技术论坛

新手求助---asp读取数据问题?

ningzhonghui 发布于 2010-11-20 19:56, 500 次点击
asp问题?

目的:相应对应  用户 根据 music表中 musictype 中的数字 就能写出对应 musictype表中 musictype  的数据
比如:1.asp?urer=用户2      music表中 musictype 中的3 就能写出对应 musictype表中 musictype 中的 六哲

music表        id       musictype    username
                   1             1            用户1
                   2             2            用户1
                   3             3            用户2
                   4             4            用户3

musictype表  id       musictype    username
                   1            欢子           用户1
                   2            郑源           用户1
                   3            六哲           用户2
                   4            刀狼           用户3


麻烦版主以用高手兄弟们帮帮我拉要怎么写法才好? 小弟在此谢谢先

[ 本帖最后由 ningzhonghui 于 2010-11-20 22:13 编辑 ]
4 回复
#2
gupiao1752010-11-20 21:42
sql="select musictype from musictype where username=(select username from music where musictype=3)"复合SQL语句。这个是形式组合。具体该怎么想我也想忘记了。你把这个拿到ASP里执行看看,具体还有什么错误区别!
#3
ningzhonghui2010-11-20 22:03
谢谢版主 不过还是不行 再帮忙想想要怎么写
<!--#include file="conn.asp"-->
<% '从数据库中读出音乐数据
user=trim(request.QueryString("user"))

set rs=server.createobject("adodb.recordset")
sql="select musictype from musictype where username=(select username from music where musictype=3)"
    rs.open sql,conn,1,3
%>
<%
Response.BinaryWrite(ChrB(239))
Response.BinaryWrite(ChrB(187))
Response.BinaryWrite(ChrB(191))
response.Clear()
response.Charset="UTF-8"
response.ContentType="text/xml"
%>

<list>
skins = "<%=rs("musictype")%>"
</list>
#4
gupiao1752010-11-20 22:45
sql="select musictype from musictype where username=(select username from music where musictype=3)"
    rs.open sql,conn,1,3
这个执行后有何错误提示。还是之后读不出数据呢?
#5
ningzhonghui2010-11-20 22:52
没提示出现错误啊  就是读不出数据
1