从数据库中循环读出符合条件的某个字段记录 并加到一个字符串 记录之间用逗号分开
<form name="form1" method="post" action="sendsms_s.asp"align="right">
<table width="80%" align="right"height="167" border="0">
<tr>
<td> </td>
<td><font color="#FF0000">查找结果:</font></td>
</tr>
<tr>
<td width="13%"> </td>
<td width="87%"> 共找到符合上述条件的用户
<%
idayfrom=request("idayfrom")
idayto=request("idayto")
sex=request("sex")
edu=request("edu")
bdayfrom=request("bdayfrom")
bdayto=request("bdayto")
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from person where sex='"&sex&"'and edu='"&edu&"'and bday between '"&bdayfrom&"'and '"&bdayto&"' and mobiletype=1"
rs.open sql,conn,1,1
redim a(cint(rs.recordcount))
i=0
do while not rs.eof
a(i+1)=a (i)&","&rs("shouji")
i=i+1
rs.movenext
Loop
%>
<%=rs.recordcount%> 位<input type="text" name="mobilecode" value="<%=a(cint(rs.recordcount))%>"></td>
</tr>
<tr>
<td> </td>
<td><font color="#FF0000">向以上用户发送短信:</font> </td>
</tr>
<tr>
<td height="70" align="right">内容: </td>
<td><textarea name="textarea"></textarea>
(请不要超过70个汉字) </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="发送短信"> </td>
</tr>
</table>
</form>
但是这句话 a(i+1)=a (i)&","&rs("shouji")
查出来的值为 " ,,13812312312"
而不是 ",13812312312,13812345678"不知道为什么
其实我就通过循环把数据库中符合条件的手机号显示到一个字符串或者一个字符数组里面
并且之间用 逗号 连接 如: ,13812312312,13812345678,......
不知道大家有没有其他好的方法