Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/01/2005, 15:49
Avatar de vpino
vpino
 
Fecha de Ingreso: diciembre-2004
Ubicación: colombia
Mensajes: 265
Antigüedad: 20 años, 4 meses
Puntos: 0
gracias por contestar: el directorio del que dispongo es el siguiente C:\Archivos de programa\Seagate Crystal Reports\sample\Xtreme\aspweb y el programa report.asp es el que sigue:
<% if Session("username") = "" then
Response.Redirect("logon.asp")
end if
%>
<%
' Make sure the browser does not cache this file
response.expires = 0

' Get the requested report name
rpttoview = request.querystring("rpt")

' Set a default, to show a group tree
' this can be modified for indivual reports
showgrouptree = "1"

' the viewer type is detected and stored in this variable
viewer = Session("init")

'Save the reportn name that is being processed
Session("report") = rpttoview

'build full path for report
fullpathtorpt = MID(request.ServerVariables("PATH_TRANSLATED"), 1, (LEN(request.ServerVariables("PATH_TRANSLATED"))-32)) & "\reports\xtreme\" & rpttoview & ".rpt"

' Need to set the location of the data, this is done to illustrate
' the capability of the automation server.
' Build the path to the xtreme.mdb
pathtomdb = MID(request.ServerVariables("PATH_TRANSLATED"), 1, (LEN(request.ServerVariables("PATH_TRANSLATED"))-32)) & "\xtreme.mdb"

' Only create the Crystal Application Object on first time through

If Not IsObject ( Session ("oApp")) Then
Set Session ("oApp") = Server.CreateObject("Crystal.CRPE.Application")
End If

' Turn off all Error Message dialogs
Set oGlobalOptions = Session ("oApp").Options
oGlobalOptions.MorePrintEngineErrorMessages = 0


' Open the report

Set Session("oRpt") = Session("oApp").OpenReport(fullpathtorpt)

' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0

' now set the table location
Set oDB = session("oRpt").Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next



' Based on the selected report, modify various report parameters

Select Case rpttoview

Case "customer"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12
' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("orders.rpt")

' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next

Case "empsales"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12

Case "statemnt"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12

Case "maillabl"
' Turn off grouptree for this report
showgrouptree = "0"

Case "balance"
' Turn off grouptree for this report
showgrouptree = "0"

Case "finstate"
' Turn off grouptree for this report
showgrouptree = "0"
' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("income.rpt")
' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next

' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("fr2.rpt")

' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next

Case "income"
' Turn off grouptree for this report
showgrouptree = "0"


End Select


' This method forces all records to be read
Session("oRpt").ReadRecords

' The PageEngine object can derive all (drill down)views of the report
Set Session("oPageEngine") = Session("oRpt").PageEngine

' Now decide what viewer to create

Select Case viewer

Case "java"
%>
<html><body
<%
if(Session("page")="fr_sales" ) then
response.write(" bgcolor=#003366")
elseif(Session("page")="fr_company") then
response.write(" bgcolor=#330066")
elseif(Session("page")="fr_eis") then
response.write(" bgcolor=#186666")
elseif(Session("page")="fr_warehouse") then
response.write(" bgcolor=#990000")
end if


%>

>




<applet

ALIGN = LEFT
code=ReportViewer.class
codebase="/viewer/JavaViewer"
id=ReportViewer
width=100%
height=95% >
<param name=ReportName value="rptserver.asp">
</applet>
</body>
</html>
<%
Case "actx"
%>
<html><body
<%
if(Session("page")="fr_sales" ) then
response.write(" bgcolor=#003366")
elseif(Session("page")="fr_company") then
response.write(" bgcolor=#330066")
elseif(Session("page")="fr_eis") then
response.write(" bgcolor=#186666")
elseif(Session("page")="fr_warehouse") then
response.write(" bgcolor=#990000")
end if


%>

>
<OBJECT ALIGN = LEFT ID="CRViewer" WIDTH=100% HEIGHT=95%
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
CODEBASE="/viewer/activeXViewer/CRViewer.dll#Version=1,2,0,30">
<PARAM NAME="Report Name" VALUE="rptserver.asp">
<PARAM NAME="Show Group Tree" VALUE= <% response.write showgrouptree %>>
<PARAM NAME="Show Toolbar" VALUE= 1>
</OBJECT>

<%
Case "html_frame"
response.redirect "htmstart.asp"

Case "html_page"

response.redirect "rptserver.asp"



end select

%>



y no entiendo el programa,yo he utilizado esta misma version de crystal en visual basic 6.0 y funciona muy bien, sera porque las lineas del programa en vb son pocas, en vb el el siguiente:

CReports.Connect = "DSN=xxxxxx;UID=xxxx;PWD=xxxx"
Nombre_Reporte = App.Path & "\ReporHoja.rpt"
CReports.ReportFileName = Nombre_Reporte
CReports.SortFields(0) = sort
CReports.WindowState = crptMaximized
CReports.Action = 1
CReports.ReportFileName = Empty

como puedes ver el codigo de asp es demasiado y me complica, te agradezco la ayuda