打印问题,急,帮忙看一下,

crodling 2001-11-19 07:45:37
<%response.expires=0%>
<html>
<head>
<title>
打印催领通知
</title>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>

<style type="text/css">
<!--
.bgwhite
tr{ background-color:#cccccc;COLOR: #660000; FONT-SIZE: 12px; FONT-WEIGHT: normal; LINE-HEIGHT: 18px; TEXT-DECORATION: none;
font-size:12px}
.t{COLOR: #660000; FONT-SIZE: 12px; FONT-WEIGHT: normal; LINE-HEIGHT: 18px; TEXT-DECORATION: none;
font-size:12px}

}
-->
</style>
</head>
<!--#include file="adovbs.inc"-->
<!--#include file="zf_include.asp"-->
<%set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn '打开送检仪器数据库
set objRS1=server.CreateObject("adodb.recordset")
objRS1.CursorType=adOpenStatic
objRS1.ActiveConnection=objCnn
'打印状态为检测完成的,尚未打印的仪器
objRs1.source="select user_factory_id from device where state_id=3 and printdate=0 group by user_factory_id"
objrs1.open

if objRs1.eof then
response.write("<body bgcolor=#99cc66>没有帐单需要打印</body>")
response.end
end if
do until objRs1.eof

user_factory_id=objRs1("user_factory_id")
set objRS2=server.CreateObject("adodb.recordset")
objRS2.CursorType=adOpenStatic
objRS2.ActiveConnection=objCnn
objRs2.source="select * from user_factory where id='"&user_factory_id&"'"
objRs2.open
FactoryName=objRs2("names")
zip=objRs2("zip")
objRs2.close
%>

<body bgcolor=#99cc66>
<p align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="+2">催领通知 </font></p>
<table CELLPADDING=0 CELLSPACING=0 border=0 width=100% align=center bgcolor=blue>
<tr>
<td>
<table CELLPADDING=0 CELLSPACING=1 border=0 width=100% align=center class="bgwhite">
<tr>
<td>id
</td>
</tr>
<%Dim objCnn,objRS
set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn
set objRS=server.CreateObject("adodb.recordset")
objRS.CursorType=adOpenStatic
objRS.ActiveConnection=objCnn
objRS.Source="select * from device order by weiyi Asc"
objRS.open
count=0
'此处对检完仪器的字段名,输出对应记录的记录值%>
<%do until objRS.eof
……
<%objRS.movenext
objRs2.source="update device set printdate=1 where weiyi='"&weiyi&"'"
objRs2.open
loop
%>
</table>
</td>
</tr>
</table>
<%
objRS.close
objRs1.movenext
exit do
loop
%>
<p>
<table width=100%>
<tr>
<td width=90%><a class=t onclick="javascript:window.print();window.close();" target="_self">打印</a>
</td>
<td><font class=t>日期:<%=date()%></font>
</td>
</tr>
</table>
<% set objRs=nothing
objCnn.close
set objCnn=nothing
%>
</body>
<%response.write("<script language=""javascript"">")%>
<!--
window.print();
//window.close()
-->
<%response.write("</script>")%>
</html>

当我在最后使用window.print()想让它自动打印的时候它却打印出来了,没有帐单需要打印,如果我点击打印按钮,则它会打印出正确需要的页面来,奇怪!这是怎么回事?
...全文
53 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
crodling 2001-11-19
  • 打赏
  • 举报
回复
<%response.expires=0%>
<html>
<!--#include file="adovbs.inc"-->
<!--#include file="zf_include.asp"-->
<%set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn
set objRS1=server.CreateObject("adodb.recordset")
objRS1.CursorType=adOpenStatic
objRS1.ActiveConnection=objCnn
objRs1.source="select user_factory_id from device where state_id=3 and printdate=0 group by user_factory_id"
objrs1.open
if objRs1.eof then
response.write("<body bgcolor=#99cc66>没有帐单需要打印</body>")
response.end
end if
do until objRs1.eof
user_factory_id=objRs1("user_factory_id") %>
<body bgcolor=#99cc66>
<table CELLPADDING=0 CELLSPACING=1 border=0 width=100% align=center class="bgwhite">
<tr>
<td>id
</td>
</tr>
<%Dim objCnn,objRS
set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn '打开送检仪器数据库
set objRS=server.CreateObject("adodb.recordset")
objRS.CursorType=adOpenStatic
objRS.ActiveConnection=objCnn
objRs="select * from device"
objRS.open
count=0
'此处对检完仪器的字段名,输出对应记录的记录值%>
<%do until objRS.eof
count=count+1
if count>=15 then
exit do
end if
weiyi=objRs("weiyi")
<tr>
<td><%=objRS("weiyi")%>
</td>
</tr><%objRS.movenext
set objRS2=server.CreateObject("adodb.recordset")
objRS2.CursorType=adOpenStatic
objRS2.ActiveConnection=objCnn
objRs2.source="update device set printdate=1 where weiyi='"&weiyi&"'"
objRs2.open
loop
%>
</table>
<%
objRS.close
objRs1.movenext
exit do
loop
%>
<p>
<a class=t onclick="javascript:window.print();window.close();" target="_self">打印</a>
<% set objRs=nothing
objCnn.close
set objCnn=nothing
%>
</body>
<script language="javascript">
<!--
window.print();
-->
</script>
</html>

上面那太长了换个短点的

28,406

社区成员

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

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