Asp+| Advanced | Client test_print_report.asp
<meta content= "text/html; Charset=big5 "http-equiv=" Content-type ">
<title>client use RDS produce Excel report</title>
<body bgcolor= "Skyblue" topmargin=0 leftmargin= "oncontextmenu=" "return false" rightmargin= "0" bottommargin= "0" >
<form action= "test_print_report.asp" method= "post" name= "MyForm" >
<div align= "center" ><center>
<table border= "5" bgcolor= "#ffe4b5" style= "HEIGHT:1PX; top:0px "bordercolor=" #0000ff ">
<tr>
<TD align= "Middle" bgcolor= "#ffffff" bordercolor= "#000080" >
<font color= "#000080" size= "3" >
Client use RDS produce Excel
</font>
</td>
</tr>
</table>
</div>
<div align= "Left" >
<input type= "button" value= "Query Data" name= "Query" language= "VBScript" onclick= "Fun_query" () "style=" HEIGHT:32PX; width:90px ">
<input type= "button" value= "Clear Data" name= "clear" language= "VBScript" onclick= "Fun_clear" () "style=" HEIGHT:32PX; width:90px ">
<input type= "button" value= "Excel", "name=", "language=" VBScript "onclick=" Fun_excel () "Style=" HEIGHT: 32px; width:90px ">
</div>
<div id= "AddData" ></div>
</form></center>
</body>
<script language= "VBScript" >
Dim rds,rs,df
Dim strsql,strrs,strcn,rowcnt
Dim xlapp, Xlbook, Xlsheet1,xlmodule,xlpagesetup
Dim headrowcnt,titlerowcnt,contentrowcnt,footrowcnt
Dim pagerowcnt,pageno,totalpagecnt,contentrownowcnt
Dim columnallwidth,columnawidth,columnbwidth,columncwidth,columndwidth
Sub Fun_query ()
Set rds = CreateObject ("RDS.") DataSpace ")
Set df = rds. CreateObject ("RDSServer.DataFactory", "http://iscs00074")
Strcn= "Driver={sql Server}; server=iscs00074; Uid=sa; App=microsoft Development environment;database=pubs; User Id=sa; password=; "
strSQL = "SELECT * From Jobs"
Set rs = df. Query (STRCN, strSQL)
If not rs.eof then
strrs= "<table Border=1><tr><td>job_id</td><td>job_desc</td><td>max_ Lvl</td><td>min_lvl</td></tr><tr><td> "+ Rs. GetString (,, "</td><td>", "</td></tr><tr><td>", "") + "</td></tr> </table> "
Adddata.innerhtml=strrs
Strrs= ""
Else
MsgBox "No data in the table!"
End If
End Sub
Sub Fun_clear ()
Strrs= ""
Adddata.innerhtml=strrs
End Sub
Sub Fun_excel ()
Set rds = CreateObject ("RDS.") DataSpace ")
Set df = rds. CreateObject ("RDSServer.DataFactory", "http://iscs00074")
Strcn= "Driver={sql Server}; server=iscs00074; Uid=sa; App=microsoft Development environment;database=pubs; User Id=sa; password=; "
strSQL = "SELECT count (*) as recordcnt from Jobs"
Set rs = df. Query (STRCN, strSQL)
Totalpagecnt=rs ("recordcnt")
&n