<%
wj=request("wj")
wj= replace(wj, "?", "%")
wj= replace(wj, ".", "%")
wj= replace(wj, "'", "%")
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject (")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_ = "SELECT
actiondate , DeviceName,PrimaryOwner FROM AS c join dbo.ShadowCopyAction AS s on = WHERE FileName like N'%"&wj&"%'"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.Form("text") <> "") Then
Recordset2__MMColParam = Request.Form("text")
End If
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. xmlns:ice="http://ns.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>多条件查询</title>
<script src="includes/ice/ice.js" type="text/javascript"></script>
<style type="text/css">
#bod {
height: 200px;
width: 900px;
margin-top: 0px;
margin-right: auto;
margin-bottom: auto;
margin-left: auto;
}
#form1 {
height: 30px;
width: 100%;
margin-top: 10px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
text-align: center;
}
.aa {
background-color: #4799D3;
}
.a1 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
#qw{
height: 50px;
width:900px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
background-repeat: repeat-x;
background-image: url(images/aa_01.jpg);
}
#asd {
width: 900px;
height: auto;
margin-top: 10px;
}
</style>
</head>
<% If Recordset1.EOF And Recordset1.BOF Then %>
<script
language="javascript" type="text/javascript">
alert("没有相关信息!");
</script>
<% End If' end Recordset2.EOF And Recordset2.BOF %>
<body>
<div id="bod">
<div id="qw">
<form id="form1" name="form1" method="POST" action="">
当前查找内容为: <%Response.Write request("wj")%>
</form>
</div>
<div id="asd">
<SCRIPT LANGUAGE="javascript">
<!--
function AutoExcel(){
var oXL = new ActiveXObject("Excel.Application"); //创建应该对象
var oWB = oXL.Workbooks.Add();//新建一个Excel工作簿
var oSheet = oWB.ActiveSheet;//指定要写入内容的工作表为活动工作表
var table = document.all.data;//指定要写入的数据源的id
var hang = table.rows.length;//取数据源行数
var lie = table.rows(0).cells.length;//取数据源列数
// Add table headers going cell by cell.
for (i=0;i<hang;i++){//在Excel中写行
for (j=0;j<lie;j++){//在Excel中写列
//定义格式
oSheet.Cells(i+1,j+1).NumberFormatLocal = "@";//将单元格的格式定义为文本
//oSheet.Cells(i+1,j+1).Font.Bold = true;//加粗
oSheet.Cells(i+1,j+1).Font.Size = 10;//字体大小
oSheet.Cells(i+1,j+1).value = table.rows(i).cells(j).innerText;//向单元格写入值
}
}
oXL.Visible = true;
oXL.UserControl = true;
oXL=null
}
//-->
</SCRIPT>
<table width="900" border="1" id="date" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td colspan="4" align="right">查询日期:
<%Response.Write Now()%></td>
</tr>
<tr class="aa">
<td width="168">计算机名</td>
<td width="168">用户名</td>
<td width="151">复制日期</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
<tr>
<td><%=(Recordset1.Fields.Item("DeviceName").Value)%></td>
<td><%=Recordset1.Fields.Item("PrimaryOwner").Value%></td>
<td><%=(Recordset1.Fields.Item("actiondate").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
</div>
<input type="button" name="out_excel" onclick="AutoExcel();" value="导出到excel">
</div>
</body>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
这是其中的代码段。我在网上找了一个,导出报表代码但不行。
[
本帖最后由 xsl 于 2010-8-4 12:59 编辑 ]