<table>
<tr>
<td width="260" height="50" colspan="2"><font size=3><b>查询</b></font></td>
</tr>
<tr>
<td width="260" height="30" colspan="2">请选择所查询的单位:</td>
<form name="xuanze_form" method="post" action="b.asp">
<td width="260" height="50" colspan="2">
<select name="dw">
<option value="701">d1</option>
<option value="703">d2</option>
<option value="704">d3</option>
<option value="705">d4</option>
<option value="706">d5</option>
<option value="707">d6</option>
<option value="708">d7</option>
</select>
</td>
<tr>
<td height="28" align="right">起始日期 </td>
<td width="30%"> <input type="text" name="qsrq" maxlength=8 size="16" class="input" tabindex="1"> </td> <input type="hidden" name="submits" value="查 询" tabindex="3">
<td width="30%" align="left" rowspan="2"> <input type="image" src="/image/btn_check.gif"> </td>
</tr>
<tr>
<td height="30" align="right">终止日期 </td>
<td> <input type="text" name="zzrq" maxlength=8 size="16" class="input" tabindex="2"> </td>
</tr>
</form>
</table>
b.asp代码如下:
<div id=tableExcel>
<%
Server.ScriptTimeOut=999999
dim conn,rs,qsrq,zzrq,dw
dw=Request("dw")
qsrq=Request("qsrq")
zzrq=Request("zzrq")
Set conn=Server.CreateObject("ADODB.Connection")
connstr="Provider=OraOLEDB.Oracle;Data Source=cxnew;User Id=xxxx;Password=xxxxxxxx;"
conn.Open connstr
sql="select b.GROUP_NAME,COUNT(a.id_no) cntusr,SUM(a.paymoney) pfee from WPAY_200811 a,DGROUPMSG_00 b where trim(a.GROUP_ID)=trim(b.GROUP_ID) and a.BACK_FLAG=0 and a.OP_CODE in ('1104','1108','1109') and substr(b.BOSS_ORG_CODE,1,4)="&dw&" and to_char(a.OP_TIME,'yyyymmdd') between "&qsrq&" and "&zzrq&" group by b.GROUP_NAME"
set rs=conn.execute(sql)
if rs.RecordCount=0 then
%>
<script language=vbscript>
msgbox "无数据,请核对日期",48,"添加失败"
window.history.go(-1)
</script>
<%else%>
<center><font size="5" color="#FF0000"><b> 查询结果
</b></font>
<font size="5"> </font></b>
<table border=1 width="90%" align=center>
<td align="center">渠道</td>
<td align="center">用户数</td>
<td align="center">费用</td></tr>
<% if rs.eof=false then %>
<tr>
<td align="center"><%=rs.fields("group_name") %></td>
<td align="center"><%=rs.fields("cntusr") %></td>
<td align="center"><%=rs.fields("pfee") %></td>
</tr>
<% rs.movenext %>
<% while rs.eof=false %>
<tr>
<td align="center"><%=rs.fields("group_name") %></td>
<td align="center"><%=rs.fields("cntusr") %></td>
<td align="center"><%=rs.fields("pfee") %></td>
</tr>
<%
rs.movenext
wend
end if
%>
</table>
<% rs.close
conn.close
%>
<%end if%>
</div>
红色部分的SQL语句在TOAD中运行有返回结果,为什么在ASP页面运行返回结果为空呢?