用Crystal Report RunTime的Application对象的NewReport方法。
解决方案 »
- 多页面游览器,打开页面TabStrip项卡,怎么双击关闭TabStrip项或TabStrip有关闭按钮?
- 求Acos(x)=dx/l
- 从文本框中添加内容到LISTBOX控件里
- 如何把字符串中的引号如“改为6 而把”改为9
- 打印报表一定要用datareport吗?
- like模糊查询,我想截取当中几个字查询怎样实现呢?
- 高手指点一下:如何给VB6.0的标题栏放图片????????????????????????????谢谢
- ★★★紧急提问,关于动态连接库调用,请熟悉VC和VB的朋友帮忙★★★
- 如何用ado显示一个access97下的表
- 用MAPI发送邮件,而不调用默认的outlook,可以实现吗?怎么实现?请教,急!!!111
- 高分求教——怎样识别条形码扫描仪的输入?
- 菜鸟的问题
是这个:Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
Set oConn = Server.CreateObject("ADODB.Connection")oConn.Open("Xtreme Sample Database")set session("oRs") = Server.CreateObject("ADODB.Recordset")session("oRs").ActiveConnection = oConnsession("oRs").Open "SELECT [Product ID], [Product Name] FROM Product"reportname = "ADORecordset.rpt"If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
End If Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End ifSet session("oRpt") = session("oApp").OpenReport(path & reportname, 1)session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = Falsesession("oRpt").DiscardSavedData
set Database = session("oRpt").Databaseset Tables = Database.Tablesset Table1 = Tables.Item(1)Table1.SetPrivateData 3, session("oRs") 'The "SetPrivateData" line tells the report that it datasource is now the recordset
'Now the report will display the data contained in the session("oRs") record set.
'If your report contained a subreport that was based off this or a different reordset
'you must follow the same steps above only referencing the subreport object.
'
'
'====================================================================================
' Retrieve the Records and Create the "Page on Demand" Engine Object
'====================================================================================On Error Resume Next
session("oRpt").ReadRecords
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source"
Else If IsObject(session("oPageEngine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
End If ' INSTANTIATE THE CRYSTAL REPORTS SMART VIEWER
'
'When using the Crystal Reports automation server in an ASP environment, we use
'the same page on demand "Smart Viewers" used with the Crystal Web Report Server.
'The are four Crystal Reports Smart Viewers:
'
'1. ActiveX Smart Viewer
'2. Java Smart Viewer
'3. HTML Frame Smart Viewer
'4. HTML Page Smart Viewer
'
'The Smart Viewer that you use will based on the browser's display capablities.
'For Example, you would not want to instantiate the Java viewer if the browser'did not support Java applets. For purposes on this demo, we have chosen to
'define a viewer. You can through code determine the support capabilities of
'the requesting browser. However that functionality is inherent in the Crystal
'Reports automation server and is beyond the scope of this demonstration app.
'
'We have chosen to leverage the server side include functionality of ASP
'for simplicity sake. So you can use the SmartViewer*.asp files to instantiate
'the smart viewer that you wish to send to the browser. Simply replace the line
'below with the Smart Viewer asp file you wish to use.
'
'The choices are SmartViewerActiveX.asp, SmartViewerJave.asp,
'SmartViewerHTMLFrame.asp, and SmartViewerHTMLPAge.asp.
'Note that to use this include you must have the appropriate .asp file in the
'same virtual directory as the main ASP page.
'
'*NOTE* For SmartViewerHTMLFrame and SmartViewerHTMLPage, you must also have
'the files framepage.asp and toolbar.asp in your virtual directory.viewer = Request.Form("Viewer")'This line collects the value passed for the viewer to be used, and stores
'it in the "viewer" variable.If cstr(viewer) = "ActiveX" then
%>
<!-- #include file="SmartViewerActiveX.asp" -->
<%
ElseIf cstr(viewer) = "Netscape Plug-in" then
%>
<!-- #include file="ActiveXPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "Java using Browser JVM" then
%>
<!-- #include file="SmartViewerJava.asp" -->
<%
ElseIf cstr(viewer) = "Java using Java Plug-in" then
%>
<!-- #include file="JavaPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "HTML Frame" then
Response.Redirect("htmstart.asp")
Else
Response.Redirect("rptserver.asp")
End If
'The above If/Then/Else structure is designed to test the value of the "viewer" varaible
'and based on that value, send down the appropriate Crystal Smart Viewer.
%>