| | | 在ASP网页中实现音乐提醒功能 一 | | 2000-10-31·
·郑冠军··yesky
| ”收咚诘牟棵畔狄桓隹突Х裰行牡淖懿浚梅裰行脑谠冻躺栌?个工作站。信息处理采用总部受理客户投诉,通过计算机网络发单至远程工作站,工作站处理后通过网络上传至总部服务器SQL数据库中,再由总部检查、监督质量的工作模式。为实现总部立即知道工作站信息处理的结果,在信息受理表单的网页中插入了信息列表(音乐提醒)功能,总部可以在任何时刻获得工作站在最近的1小时内处理并上传的信息。在web服务器采用Win4.0和IIS4.0,数据库采用SQL Server7.0,浏览器IE5.0条件下测试通过。具体实现过程如下:
main.asp ‘总部信息受理的页面 /* water为SQL Server中数据库hzhot 的一张表,status ,n_bz2,d_cl为water 的字段*/ $#@60;% response.buffer=true ‘设置buffer为true,表明asp程序必须运行才能显示
Response.ExpiresAbsolute = Now() - 1 ‘让网页立即过期*
Response.AddHeader "Cache-Control", "private" "同上 %$#@62; $#@60;html$#@62; $#@60;head$#@62; $#@60;title$#@62;main $#@60;/title$#@62; $#@60;meta http-equiv="refresh" content="60"$#@62;$#@60;%’每60秒钟刷新一次页面%$#@62; $#@60;/head$#@62; ....... $#@60;% Set Cnn = Server.CreateObject("ADODB.Connection") ‘与数据库建立连接并按条件检索记录 StrCnn="Driver={SQLServer};Server=hzhotsvr;UID=loy;PWD=loy;Database=hzhot" Cnn.Open StrCnn set rs=Server.CreateObject("ADODB.recordset") mySQL="select * from water " mysql=mysql& " where status="&"""&"z"&""" &" and n_bz2=0" ‘z是字段status的值,表示信息已经被 ‘处理;0是字段n_bz2 的值,表示信息 ‘未被总部检查。 if hour(now())=0 then ‘判断是否是子夜 mysql=mysql&" and (datediff(day,d_cl,getdate())=1 and datediff(hour,d_cl,getdate())$#@60;24)" else mysql=mysql&" and (datediff(day,d_cl,getdate())=0 and datediff(hour,d_cl,getdate())$#@60;1)" ‘利用(datediff(day,d_cl,getdate())=0 and datediff(hour,d_cl,getdate())$#@60;1)判断在最近1小时内收到的被处理但 ‘未被总部检查的信息,d_cl表示信息的时间 set rstemp=cnn.execute(mySQL) ‘执行SQL语言,并取得了一个recordset对象实例rstemp rstemp.EOF or BOF then else response.redirect "alert.asp" ‘若检索到信息则转到信息列表(音乐提醒)页面 end if rstemp.close "关闭recordset对象实例 set rstemp=nothing "释放系统资源 cnn.close "断开与数据库的联接 set conntemp=nothing "释放系统资源%$#@62;.... alert.asp‘信息列表(音乐提醒)页面 $#@60;% response.buffer=true "设置buffer为true,表明asp程序必须运行才能显示 Response.ExpiresAbsolute = Now() - 1 "让网页立即过期 Response.AddHeader "Cache-Control", "private" "同上 %$#@62;
| | | 感谢
访问天极网,如果您觉得该文章涉及版权问题,请看这里!
|
|