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>
<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