<%
set rs_del=server.createobject("adodb.recordset")
set rs_ins=server.createobject("adodb.recordset")
set rs_w_del=server.createobject("adodb.recordset")
set rs_w_ins=server.createobject("adodb.recordset")
sql_del="delete from temp_1"
sql_ins="insert into temp_1(machineid,machinename,platebegin,plateend,sectionnumber,modulecode,platetime ) select a.machineid,a.machinename,b.platebegin,b.plateend,c.sectionnumber,e.modulecode,b.platetime from machine a,detailsection b,OrderDetail c ,producemanage d,operation e where a.machineid = b.machineid and b.orderdetailid= c.orderdetailid and c.producemanageid=d.producemanageid and d.operationid=e.operationid and c.closed=0 and e.modulecode<>'' and b.platebegin IS NOT NULL "
sql_w_del="delete from tmp_sql"
sql_w_ins="insert into tmp_sql select a.machineid,a.machinename,b.platebegin,b.plateend,b.sectionnumber,b.modulecode,e.deptname,e.deptid,a.remark,b.platetime from machine a,temp_1 b,workstep c,SetActualizeStepDisplay d,dept e where a.machineid *= b.machineid and a.workstepid = c.workstepid and c.workstepid = d.workstepid and d.deptid = e.deptid and e.deptid=20 and exists(select 1 from (select machineid,maxplatebegin = max(platebegin) from temp_1 group by machineid ) f where machineid = f.machineid and platebegin = f.maxplatebegin ) order by 2"
rs_del.open sql_del,connp,1,1
'rs_del.close
set rs_del=nothing
rs_w_del.open sql_w_del,connp,1,1
'rs_del.close
set rs_w_del=nothing
rs_ins.open sql_ins,connp,1,1
'rs_ins.close
set rs_ins=nothing
rs_w_ins.open sql_w_ins,connp,1,1
'rs_ins.close
set rs_w_ins=nothing
%>
ç¨SQLçä½ä¸æ¥å®ç°å¾ç®åï¼
1ãå å建åå¨è¿ç¨ï¼
CREATE PROCEDURE dbo.Usp_AutoExec2ãå建SQLä½ä¸
http://jingyan.baidu.com/article/49ad8bce7287315834d8fab4.html
如果刷新页面,整个程序都会从头开始了,我只是想把上面的代码执行,能不能用回圈呀,
追答你可以把你这段代码单独保存为一个asp文件,再加上我上面所说的代码(注意必须放在的外面),然后在当前页面利用一个iframe来调用它(根据需要可以把iframe设为隐藏的),这样它就会自动每隔5分钟运行一次了。
也可以利用xmlhttp来定时调用它(这时候就不用加上我的代码了)。
如果你不懂或者不想写程序代码,建议用第一种方法,如果熟悉JavaScript和ajax,可以用第二种方法。