An article about the client using ASP to participate in the report of the good Dongdong

Source: Internet
Author: User
Tags query
The client first posts a simpler Asp+rds client-side report
This article hopes to enter the essence
Next post a more complicated
Note: (If you are prompted that an ActiveX component cannot participate in RDS.) DataSpace)
IE need to set security options
Action: Menu Tool->internet option-> security-> Customization
Set start but ActiveX not labeled Security-> Open
<meta content= "text/html; charset=gb2312 "http-equiv=content-type>
<title>client use RDS produce Excel report</title>
<link rel= "stylesheet" href= "Cdutmenu/common.css" >
<body bgcolor=skyblue topmargin=5 leftmargin= "oncontextmenu=" return false rightmargin=0 bottommargin= "0" >

<div align= "center" ><center>
<table border= "1" 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>

<form action= "long.asp" method= "post" name= "MyForm" >
<div align=left>
<input type= "button" value= "Query Data" name= "Query" language= "VBScript" onclick= "Fun_excel (1)" style= "height:32px ; width:90px ">
<input type= "button" value= "Clear Data" name= "clear" language= "VBScript" onclick= "Fun_excel" (2) "style=" height:32px ; width:90px ">
<input type= "button" value= "Excel", "name=", "language=" VBScript "Onclick=" Fun_excel (3) "Style=" HEIGHT: 32px; width:90px ">
</div>
<div id= "AddData" ></div>
</form>
</body>

<script language= "VBScript" >
Sub Fun_excel (t)
Dim RDS,RS,DF
Dim Strcn,strsql,strrs
Dim xlapp, Xlbook, XlSheet1

' Use RDS to produce client recordset
Set rds = CreateObject ("RDS.") DataSpace ")
Set df = rds. CreateObject ("RDSServer.DataFactory", "http://server name")
' The connection string to SQL Server to query database:pubs--->table:jobs
Strcn= "Driver={sql Server}; Server=server name; Uid=sa; App=microsoft Development environment;database=pubs; User Id=sa; password=; "
' The query string of SQL
strSQL = "SELECT Top 8 * out of jobs order by job_id"
' The recordset
Set rs = df. Query (STRCN, strSQL)

If T=1 Then
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
ElseIf t=2 Then
Strrs= ""
Adddata.innerhtml=strrs
ElseIf t=3



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.