| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1702 人关注过本帖
标题:变量有多个逗号隔开如何逐个提取
只看楼主 加入收藏
luyishi
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-28
收藏
 问题点数:0 回复次数:1 
变量有多个逗号隔开如何逐个提取
数据库表Result
id   remark
1   a, b, c, 1, 2, 3
.      .
.      .
30   123, 我, n, ,b, 9
查询显示remark并且每行逐个,如:
a
b
c
1
2
3
代码如下:
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>123</title>
<link href="images/index.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
    dim str
    dim strs()
    dim tempstr
     set rs=server.createobject("adodb.recordset")
    sql="select * from Result where id =30  "  
    rs.open sql,conn,1,1
    do while not rs.eof
%>
<%
  rs.movenext
  loop
  rs.close
  set rs=nothing
%>
<%
str=rs("remark")
strs=split(str,",")
for i=0 to strs
response.write strs(i)
next
%>
</body>
</html>
求指点,谢谢!
搜索更多相关主题的帖子: 数据库表 content include title 如何 
2017-03-08 16:19
ke爱的小tu子
Rank: 2
等 级:论坛游民
帖 子:51
专家分:20
注 册:2021-2-11
收藏
得分:0 
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>123</title>
<link href="images/index.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
    dim str
    dim strs()
    dim tempstr
     set rs=server.createobject("adodb.recordset")
    sql="select * from Result where id =30  "  
    rs.open sql,conn,1,1
    do while true
        if rs.eof or rs.bof then
            exit do
        end if

        str=rs("remark")
        strs=split(str,",")
        for i=0 to ubound(strs)
            response.write strs(i)&"<br>"
        next
      rs.movenext
  loop
  rs.close
  set rs=nothing
%>
</body>
</html>
2021-02-11 14:28
快速回复:变量有多个逗号隔开如何逐个提取
数据加载中...
 
   



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

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