asp 读取字段逗号分隔的一条数据 40
message.s_user表里面用chexkbox存储了test,test2,test3,s_user共用id、title、message,当满足users.usern...
message.s_user表里面用chexkbox存储了test,test2,test3,s_user共用id、title、message,当满足users.username=message.s_user时,就输出其中一条title,
PS:我用split提示越线错误,请根据代码进行修改,给正确答案,谢谢。高分!!
<% dim tj,sPic,rs3
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(("sPic"),",")
for i=lbound(sPic) to ubound(sPic)
next
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" &sPic(i)& "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%i=0
do while not rs3.eof%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%rs3.movenext
i=i+1
if i=3 then exit do
loop
rs3.close %>
<% end if
%> 展开
PS:我用split提示越线错误,请根据代码进行修改,给正确答案,谢谢。高分!!
<% dim tj,sPic,rs3
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(("sPic"),",")
for i=lbound(sPic) to ubound(sPic)
next
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" &sPic(i)& "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%i=0
do while not rs3.eof%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%rs3.movenext
i=i+1
if i=3 then exit do
loop
rs3.close %>
<% end if
%> 展开
3个回答
展开全部
sPic=split(("sPic"),",") 这里不用括号 sPic=split(sPic,",")
------------------------------
<%
dim tj,sPic,rs3
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(sPic,",")
for i=0 to ubound(sPic)
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" & sPic(i) & "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%
do while not rs3.eof
%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%
rs3.movenext
loop
rs3.close
%>
<%
end if
next
%>
------------------------------
<%
dim tj,sPic,rs3
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(sPic,",")
for i=0 to ubound(sPic)
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" & sPic(i) & "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%
do while not rs3.eof
%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%
rs3.movenext
loop
rs3.close
%>
<%
end if
next
%>
追问
谢谢兄弟的帮助,不过这样是读不出数据的。
追答
cg329521 ,我绝对理解你,真滴,在百度混时间长了你说的问题绝对会碰到,我倒是真碰到过,辛辛苦苦写得code最后问题关闭了,呵呵
展开全部
<% dim tj,sPic,rs3
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(("sPic"),",")
for i=lbound(sPic) to ubound(sPic)
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" &sPic(i)& "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%i=0
do while not rs3.eof%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%rs3.movenext
i=i+1
if i=3 then exit do
loop
rs3.close %>
<% end if
next
%>
tj=trim(request("tj"))
sPic = trim(request("s_user"))
sPic=split(("sPic"),",")
for i=lbound(sPic) to ubound(sPic)
sql3 = "SELECT id,fb_time,left(title,11) as title FROM users left join message on users.username=message.'" &sPic(i)& "' where username='"&user&"' order by fb_time desc"
set rs3= Server.CreateObject("ADODB.Recordset")
rs3.open sql3,conn,1,1
if rs3.eof then
response.write "<div align='center' style='color:#ff3300'>暂无短消息</div>"
else
%>
<%i=0
do while not rs3.eof%>
<li style="line-height:18px;">·<a href="email_message.asp?id=<%=rs3("id")%>" ><%=rs3("title")%></a> <%=month(rs3("fb_time"))&"-"&day(rs3("fb_time"))&""%></li>
<%rs3.movenext
i=i+1
if i=3 then exit do
loop
rs3.close %>
<% end if
next
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
lxs_lingting 无限恼火!有木有?有木有!提问者莫做山驴呀!
更多追问追答
追问
请问有何见解,我愿与你分享。
追答
lxs_lingting应该写的没有问题!如果有也是小问题,你好好研究一下,有很多很多情况都是提问者基础太差,看不懂回答者的内容,有时候也许会有疏漏,但要看回答的思路和应用技巧!现在的提问者只要回答的一点不对就说回答错了,毕竟有些问题需要猜!提问者说的也不够详细!既然回答了就是动了一番心思,你追问的时候也搞把问题说明白为什么不行,什么错误提示!毕竟大家出于好心帮你,我们又不赚钞票!多遇到几个生猛的回答问题的!马上就寒心了!再也不愿来回答问题了!问的都不虚心,耐心,回答的为什么要回答呢?请提问也要提问出点水平!谢谢。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询