日期:2014-05-16  浏览次数:20922 次

asp+access 问卷内容分单元格显示
我手上有份问卷调查做好的数据,当初为了方便将其选项及内容混合在同一个单元格子内,目前需要使用split将其选项及回答内容隔离开并显示在页面上,我要如何编写呢?

id name result belong
229 王XX 1||||1||||1||||1||||1||||1||||1||||1||||1||||1||||无||||无||||我个人认为XX部门的服务态度不是很好… 58
230 刘XX 0||||1||||2||||2||||0||||1||||1||||1||||1||||1||||无||||无||||我没有任何要写的… 58

我现在需要将如上的信息内容显示为如下:
名字 好评价 不满意 建议项
王XX 无 无 我个人认为…
刘XX 无 无 我没有…

目前我代码只会写如下的这段,用split分离result里的"||||"我就不知道要怎么写了:
<table border="1" width="100%" id="table1"> 
<tr>
<td width="10%"><strong>名字</strong></td>
<td width="30%"><strong>好评价</strong></td>
<td width="30%"><strong>不满意</strong></td>
<td width="30%"><strong>建议项</strong></td>
</tr> 

<%
dim  Survey_id,sql,order_by,resultarr,i
Survey_id=request.QueryString("Survey_id")
call checknum(Survey_id)
sql="select * from [datum] where belong=" & Survey_id
rs.open sql,conn,1,3

do while not(rs.eof or err)
%>
<tr>
  <td width="10%"><%= rs("name")%></td>
  <td width="30%"><%= rs("name")%></td>
  <td width="30%"><%= rs("name")%></td>
  <td width="30%"><%= rs("name")%></td>
</tr> 
<%
rs.movenext
loop
rs.close
%>


有人能帮忙完善吗?

------解决方案--------------------

<%
dim  Survey_id,sql,order_by,resultarr,i
Survey_id=request.QueryString("Survey_id")
call checknum(Survey_id)
sql="select * from [datum] where belong=" & Survey_id
rs.open sql,conn,1,3

do while not(rs.eof or err)

arr=split(rs("result"),"
------解决方案--------------------
")

%>
<tr>
  <td width="10%"><%= rs("name")%></td>
  <td width="30%"><%= arr(好评价所在下标)%></td>
  <td width="30%"><%= arr(不满意所在下标)%></td>
  <td width="30%"><%= arr(建议项所在下标)%></td>
</tr> 
<%
rs.movenext
loop
rs.close
%>