📄 ourweixiudanqueryresult.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<%
Response.ExpiresAbsolute=now()-1
Response.CacheControl="no-cache"
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../../../index.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="lib.asp" -->
<!--#include file="../../../Connections/oavbsconn.asp" -->
<%
Dim rs__c
rs__c = "1"
If (request("c") <> "") Then
rs__c = request("c")
End If
%>
<%
Dim rs
Dim rs_numRows
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_oavbsconn_STRING
rs.Source = "SELECT * FROM 维修单管理 WHERE 维修类别 like '%" + Replace(rs__c, "'", "''") + "%' or 维修单编号 like '%" + Replace(rs__c, "'", "''") + "%' or 内容 like '%" + Replace(rs__c, "'", "''") + "%' or 维修时间 like '%" + Replace(rs__c, "'", "''") + "%' or 添加人帐号 like '%" + Replace(rs__c, "'", "''") + "%' or 添加人姓名 like '%" + Replace(rs__c, "'", "''") + "%' or 添加人部门 like '%" + Replace(rs__c, "'", "''") + "%' or 添加IP like '%" + Replace(rs__c, "'", "''") + "%' or 添加时间 like '%" + Replace(rs__c, "'", "''") + "%' or 添加日期 like '%" + Replace(rs__c, "'", "''") + "%' or 更新时间 like '%" + Replace(rs__c, "'", "''") + "%' or 更新日期 like '%" + Replace(rs__c, "'", "''") + "%'or 更新IP like '%" + Replace(rs__c, "'", "''") + "%'or 备注 like '%" + Replace(rs__c, "'", "''") + "%' ORDER BY id desc,更新时间 desc"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()
rs_numRows = 0
%>
<%
Dim userpath__MMColParam
userpath__MMColParam = "1"
If (Session("userssdfgfhtrh") <> "") Then
userpath__MMColParam = Session("userssdfgfhtrh")
End If
%>
<%
Dim userpath
Dim userpath_numRows
Set userpath = Server.CreateObject("ADODB.Recordset")
userpath.ActiveConnection = MM_oavbsconn_STRING
userpath.Source = "SELECT oneselffolder356u47646u4ty,pathaccess FROM usertertggbng WHERE usersdsfg56 = '" + Replace(userpath__MMColParam, "'", "''") + "'"
userpath.CursorType = 0
userpath.CursorLocation = 2
userpath.LockType = 1
userpath.Open()
userpath_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rs_total
Dim rs_first
Dim rs_last
' set the record count
rs_total = rs.RecordCount
' set the number of rows displayed on this page
If (rs_numRows < 0) Then
rs_numRows = rs_total
Elseif (rs_numRows = 0) Then
rs_numRows = 1
End If
' set the first and last displayed record
rs_first = 1
rs_last = rs_first + rs_numRows - 1
' if we have the correct record count, check the other stats
If (rs_total <> -1) Then
If (rs_first > rs_total) Then
rs_first = rs_total
End If
If (rs_last > rs_total) Then
rs_last = rs_total
End If
If (rs_numRows > rs_total) Then
rs_numRows = rs_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rs_total = -1) Then
' count the total records by iterating through the recordset
rs_total=0
While (Not rs.EOF)
rs_total = rs_total + 1
rs.MoveNext
Wend
' reset the cursor to the beginning
If (rs.CursorType > 0) Then
rs.MoveFirst
Else
rs.Requery
End If
' set the number of rows displayed on this page
If (rs_numRows < 0 Or rs_numRows > rs_total) Then
rs_numRows = rs_total
End If
' set the first and last displayed record
rs_first = 1
rs_last = rs_first + rs_numRows - 1
If (rs_first > rs_total) Then
rs_first = rs_total
End If
If (rs_last > rs_total) Then
rs_last = rs_total
End If
End If
%>
<%fname1 = makefilename(now())
fname ="关于"&request("c")&"维修单记录查询结果"&fname1&".xls"
q=userpath("oneselffolder356u47646u4ty")
p="/dataandfiles/files/u/"&q&"/"&fname
p1="/dataandfiles/files/u/"&q
%>
<%
Dim objFSO1q
Set objFSO1q= Server.CreateObject("Scripting.FileSystemObject")
If objFSO1q.FolderExists(Server.MapPath(p1)) Then
Else
objFSO1q.CreateFolder(Server.MapPath(p1))
Set objFSO1q = Nothing
end if '释放 FileSystemObject 对象实例内存空间
%>
<% on error resume next
dim rstCount,rstField
rstCount=rs.recordcount'记录行数
rstField=rs.fields.count'记录列数
rstCount=rs_total
'response.write rstCount
dim oExcel,sCellValue,Path
Set oExcel = Server.CreateObject("OWC.Spreadsheet")
dim Line,Column
Line=1
'写入列名
For Column=0 to rstField-1
sCellValue=rs.fields(Column).name'列名
sCellValue=sCellValue&""
oExcel.Cells(Line,Column+1)= sCellValue '第一行的第几列,列是循环的,行不变。
Next
'写入记录,从第二行开始先行后列的写入表中
For Line=2 to rstcount+1
For Column=0 to rstField-1
sCellValue=rs.fields(Column)
sCellValue=sCellValue&""
oExcel.Cells(Line,Column+1)= sCellValue
Next
rs.movenext
Next
'这行不知道干什么
For Column = 1 to rstField
oExcel.Columns(Column).AutoFitColumns
Next
'设置Excel表里的字体
Column = 1
Do While Column <= rstField
oExcel.Cells(1, Column).Font.Bold = True
oExcel.Cells(1, Column).Font.Italic = False
oExcel.Cells(1, Column).Font.Size = 16
Column = Column + 1
Loop
'输出该表
Path=Server.MapPath(fname)
'Path=Server.MapPath("Caseinfo.xls")
oExcel.ActiveSheet.Export Path, 0
%>
<%
if err.number<>0 then%>
<script language="javascript">
{
alert("服务器未安装office 2000软件,无法生成excel文件。office 2003 将无法在本系统导出数据。");history.go(-1)
}
</script>
<%response.end
end if%>
<link href="../../../css/link1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
<br/>
<img src="../../../img/xls.gif" width="18" height="18">
<!--#include file="copy.asp" -->
<a href=re.asp?u=<%=p%> target=_blank><%=fname%></a> <span class="style1"> <%=s1%> 导出成功,该excel表格已经保存到您的文件夹里,</span><a href="../../../f/asp/filesupadmin/jieshouselffilessdfghfg.asp">点击访问</a> <a href="javascript:history.go(-1)">返回</a><br/>
<img src="../../../img/re.gif" width="16" height="16"><a href="../../tongxunlu/down.asp?u=<%=p%>&n=<%=fname%>">下载该电子表格</a><br/>
<%
rs.Close()
Set rs = Nothing
%>
<%
userpath.Close()
Set userpath = Nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -