An article about the client with Asp+rds+vba report of Good Dongdong (Advanced article)

Source: Internet
Author: User
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>
&LT;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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.