遇到一个asp与js的代码,需要隔1小时运行一次(附源码),请前辈指导一下思路!小弟先感谢了!

salecn 2010-08-12 06:03:49
各位前辈好,遇到一个asp与js的代码,需要隔1小时运行一次(附源码),请前辈指导一下思路!小弟先感谢了!

环境:asp+iis+sqlsever2000

目的:想实通过Google Map Api的计算经纬点距离函数,每隔1小时计算下数据库中两点的距离,结果存入数据库。
(程序是用asp做的,判读距离的函数是Google Map Api的javascript代码。)

问题: 怎样让下面的asp文件每隔1小时就自动运行呢?(改成vbs行不行啊)

源代码如下:


<%@Language="VBScript" CodePage="65001"%>
<%Session.CodePage="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>计算距离</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA-9XCdVovUm991Ek1s6cgdxQxeZ2O7p53-bIxOKwikWnaEuG9JxS3SIpC7vSxeCQoW3L41AQrqZ-HdA &sensor=true_or_false" type="text/javascript"></script>
<!--#include file="../../../conn/conn.asp"-->


</script>
<%
set table=server.CreateObject("mzz.biao")
bianhao=request("bianhao")
name=request("name")

%>

<%
If Request.QueryString("name") = "" Then

'开始读取数据库中的经纬点
sql="select 当前地点,终点地点 from 业务订单 where 订单编号='"&bianhao&"'"
set startrs=conn.execute(sql)
startsql="select lon,lat from quxian where county='"&startrs("当前地点")&"'"
stopsql="select lon,lat from quxian where county='"&startrs("终点地点")&"'"
set startrs=conn.execute(startsql)
startlon=startrs("lon")
startlat=startrs("lat")
set stoprs=conn.execute(stopsql)
stoplon=stoprs("lon")
stoplat=stoprs("lat")
startrs.close
stoprs.close
'结束读取数据库中的经纬点

%>

<script type="text/javascript">
//调用Google Map Api的计算距离函数
var distance = new GLatLng(<%=startlat%>, <%=startlon%>).distanceFrom(new GLatLng(<%=stoplat%>, <%=stoplon%>));
distance=parseInt(distance/1000,10)
//通过地址栏把distance的结果传递给asp
window.location.href="<%=Request.ServerVariables("SCRIPT_NAME")%>?name=" + distance + "&dd="+<%=bianhao%>
</script>
<%


end If
'接收js的数据
juli= Request.QueryString("name")
ddbianhao= Request.QueryString("dd")
<!--#include file="../../../conn/conn.asp"-->
julisql="update 业务订单 set 终点距离="&juli&" where 订单编号='"&ddbianhao&"'"
conn.execute(julisql)

%>

...全文
105 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
salecn 2010-08-12
  • 打赏
  • 举报
回复
感谢前辈指点!
灬上海爽爷 2010-08-12
  • 打赏
  • 举报
回复
可用JS设置页面每隔多少刷新一次

把你的代码加入到这个页面中

<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout(''myrefresh()'',5000); //指定5秒刷新一次
</script>
代码下载链接: https://pan.quark.cn/s/a4b39357ea24 ### 中兴F420/F460/F660光猫超级密码配置及功能启用指南 #### 一、超级密码的获取与配置 对于中兴F420/F460/F660系列光猫设备,可以通过特定的命令行接口方法来获取并配置超级密码。以下指南详细说明了这一过程的实现方法。 **步骤1:** 启动任意一种网络浏览器,并键入网址`http://192.168.1.1/web_shell_cmd.gch`以进入命令行操作界面。 **步骤2:** 输入指令`sendcmd1DBpUserInfo`(需注意指令间的空格和大小写格式),该指令用于查询当前登录所使用的用户名及密码。通常情况下,预设的用户名与密码为`telecomadmin/telecomadmin+数字`。 **步骤3:** 如果需要变更用户名,可以在命令行环境中键入`sendcmd1DBsetUserInfo0Usernameadmin`(同样需注意空格和大小写),将用户名更改为`admin`。 **步骤4:** 继续输入`sendcmd1DBsetUserInfo0Passwordadmin`(同样需注意空格和大小写),将密码也设定为`admin`。 **步骤5:** 完成修改后,必须执行保存操作,通过输入命令`sendcmd1DBsave`(注意空格和大小写),以最终确认设置。 #### 二、远程控制功能的禁用 为了保障网络安全,防止未经授权的远程访问,应按照以下步骤禁用远程控制功能: **步骤1:** 再次启动网络浏览器并输入网址`http://192.168.1.1/web_shell_cmd.gch`。 **步骤2:** 键入指令`se...

28,403

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧