通过多次刷新页面完成大容量数据查询操作

  <%
 data_path="http://www.cnblogs.com/" 'ACC连接数据库路径,对SQL无效
 numid="19"
 dir="../err.asp"
  %>
<!--#include file="http://www.cnblogs.com/conn/conn.asp"-->
<!--#include file="../rolecheck.asp"-->
<LINK href="../css/style.css" rel=stylesheet type=text/css>
<br /><br /><br />
<%
mailusername="noreply@vipmail.yzw.cc"
mailuserpass="noreply123"
mailaddress="smtp.vipmail.yzw.cc"
fromname="中国压铸网"%>
<table cellpadding="2" cellspacing="1" border="0" width="560" align="center" class="a2">
 <tr>
  <td height="35" align="center" bgcolor="#CED8EC" ><strong>发 送 邮 件<%=mailusername%></strong></td>
 </tr>
 <tr class="a4">
  <td align="center" bgcolor="#DDE4F2">
      <br>
        <br>
      <br>     
   <%

email_id=request("email_id")
if email_id="" then
 email_id=0
end if
set rs_1=server.createobject("adodb.recordset")
sql_1="select * from log_email_title where id="&email_id&" "
rs_1.Open sql_1,conn,1,1
if not rs_1.eof then
'设置邮件主题
strTitle=rs_1("email_title")
'设置邮件内容
strContent=rs_1("email_content")
'邮箱验证正则表达式
Dim regEx ' 建立变量。
Set regEx = New RegExp '建立正则表达式。
regEx.Pattern ="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w+)+$"
regEx.IgnoreCase = True' 设置是否区分字符大小写。
regEx.Global = True  '设置全局可用性。
 If Request("page")<>"" Then
  If int(Request("page"))<1 Then
   currentPage=1
  Else
   currentPage=int(Request("page"))
  End If
 Else       
  currentPage=1       
 End If 
 MaxPerPage=1
 Set Rs=Server.CreateObject("Adodb.Recordset")
 Sql="select id,iuser,truename,email from individual_user where email<>'' and id in (select user_id from individual_user_expertlist) order by id asc"
 rs.open sql,conn,1,1

 If Not rs.Eof Then
  rs.pagesize=MaxPerPage
  mpage=rs.pagecount
  If currentPage>mpage Then
   '邮件发送记录数据库
   email_content=""
   email_content1=""
   email_i=1
   do while not rs.eof
    if regEx.test(trim(Rs("email"))) then '判断为真
    email_content=email_content&email_i&"、"&rs("email")&"--"&rs("iuser")&"--"&rs("truename")&"<br />"
    else
    email_content1=email_content1&email_i&"、邮箱格式错误:"&rs("email")&"--"&rs("iuser")&"--"&rs("truename")&"<br />"
    end if
   rs.movenext
   email_i=email_i+1
   loop
   rs.close
   set rs=nothing 
   email_content=email_content&email_content1
   '记录操作人
   if issession=0 then
       user_name=request.Cookies("username")
     else
       user_name=session("globalecmaster")
    end if
   call log_email(11,email_content,mpage,email_id,user_name)
   
   Response.Write "发送完毕 &nbsp;完成时间:"&now()
   Response.End
  End If
  rs.move (currentPage-1)*MaxPerPage
  If mpage>=currentPage Then
   SendMail1=trim(Rs("email")) '接收邮件
  End If
 Else
  Response.Write "没有数据"
  Response.End
 End If
'发送邮件过程
dim i
i=request("i")'判断发送失败的邮箱个数
if i="" or i<0 then
 i=0
end if

if regEx.test(SendMail1) then '判断为真
 call SendMail (SendMail1,strTitle,strContent,mailusername,mailuserpass,mailaddress,fromname)
else
 i=i+1
end if

Response.Write "<br><b>已发送/一共要发送:<font color=#FF0000>"&currentPage-1&"</font>/<font color=#FF0000><b>"&mpage&"</b></font>封,有<font color=#FF0000><b>"&i&"</b></font>封邮箱格式错误没有发送。"
If mpage<currentPage Then
 Response.Write ",完成时间"&Now()&"</b> "
Elseif currentPage mod 490=0 then
 Response.Write "<meta http-equiv=Refresh content='2000; URL=expert_user_Mail_Send_to.asp?page="&currentPage+1&"&i="&i&"&email_id="&email_id&"''>"
Response.Write "<br>提示:一小时之内最多只能发送500封邮件。当前时间:"&now()
else
 Response.Write "<meta http-equiv=Refresh content='3; URL=expert_user_Mail_Send_to.asp?page="&currentPage+1&"&i="&i&"&email_id="&email_id&"''>"
End If
rs.close
Set rs=Nothing
conn.Close
Set conn=Nothing

else
 response.Write("邮件内容不存在!&nbsp;&nbsp;[<a href=Bs_Mail_Send.asp >返回</a>]")
end if
%> 
<br><BR><BR>
   </td>
 </tr>
</table>

注:

meta http-equiv="refresh" content="1000" 定时刷新 refresh单位是秒

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="refresh" content="1000">
<title>隔1000秒刷新当前页面</title>
</head>
<body>
</body>
</html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="refresh" content="3;url=http://www.yongfa365.com/blog">
<title>隔3秒刷新到http://www.yongfa365.com/blog</title>
</head>
<body>
</body>
</html>

refresh 里的时间单位是

posted @ 2011-08-16 09:43  xgcdd  阅读(274)  评论(0编辑  收藏  举报