I am using crystal reports 7 inmy asp site.My reports are working fine however....
After development, it is time to move the reports to the production server. Currently, because of the reports, we have three different sites because of the way crystal reports works (ie. a report is linked directly to a database
during design).When we release a new report, it has to be coppied to all three sites, then opened with crystal and then point the database to the correct database.However, if I can get the reports to receive a connection(real time), to dynamically change the database, then we could
have one site, and reduce maintenance.According to samples and documentation, this should be possible:
GIVEN MY SOURCECODE:
Set session ("oApp" = Server.CreateObject "Crystal.CRPE.Application"
Path = Request.ServerVariables("PATH_TRANSLATED"
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
wend
Set Session("oRpt" = Session("oApp".OpenReport(path & "Kevin.rpt", 1)
session("oRpt".MorePrintEngineErrorMessages = False
session("oRpt".EnableParameterPrompting = False
' Create Database object
set CRDatabase = Session("oRpt".Database
'Database Table collection
Set CRDatabasetables = CRDatabase.tables
NTables = CRDatabasetables.Count
strServer = "MyServer"
strdb = "MyDatabase"
For I = 1 To NTables
Set CRDatabasetable = CRDatabasetables.Item(CInt(I))
CRDatabasetable.SetLogOnInfo strServer, strdb, session ("gbldbuid", session("gbldbpwd"
Report.Database.Tables.ItemI).Location= """" & strdb & ".dbo.ClinicalStaffMeetingRetrieveForReport"
Next
set StoredProcParamCollection = CRDatabase.Parameters
Set session("Param" = StoredProcParamCollection
StoredProcParamCollection.item(1).value = Session("ProgramID"
StoredProcParamCollection.item(2).value = Request.Form("BeginDate"
StoredProcParamCollection.item(3).value = Request.Form("EndDate"
Session("oRpt".ReadRecords
Seems pretty straint forward. If effect, this should change the database the report points to. The problem is, it isn't.It still goes to the existing development database and retrieves the information. My asp calls a stored procedure and passes it parameters. I have lot's with subreports, but if I can get the database to change, the rest is elementary.
I am using cr version 7 and ms sqlserver 7. Is there something in the report that needs to be set?
Any ideas??
NordicMan
After development, it is time to move the reports to the production server. Currently, because of the reports, we have three different sites because of the way crystal reports works (ie. a report is linked directly to a database
during design).When we release a new report, it has to be coppied to all three sites, then opened with crystal and then point the database to the correct database.However, if I can get the reports to receive a connection(real time), to dynamically change the database, then we could
have one site, and reduce maintenance.According to samples and documentation, this should be possible:
GIVEN MY SOURCECODE:
Set session ("oApp" = Server.CreateObject "Crystal.CRPE.Application"
Path = Request.ServerVariables("PATH_TRANSLATED"
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
wend
Set Session("oRpt" = Session("oApp".OpenReport(path & "Kevin.rpt", 1)
session("oRpt".MorePrintEngineErrorMessages = False
session("oRpt".EnableParameterPrompting = False
' Create Database object
set CRDatabase = Session("oRpt".Database
'Database Table collection
Set CRDatabasetables = CRDatabase.tables
NTables = CRDatabasetables.Count
strServer = "MyServer"
strdb = "MyDatabase"
For I = 1 To NTables
Set CRDatabasetable = CRDatabasetables.Item(CInt(I))
CRDatabasetable.SetLogOnInfo strServer, strdb, session ("gbldbuid", session("gbldbpwd"
Report.Database.Tables.ItemI).Location= """" & strdb & ".dbo.ClinicalStaffMeetingRetrieveForReport"
Next
set StoredProcParamCollection = CRDatabase.Parameters
Set session("Param" = StoredProcParamCollection
StoredProcParamCollection.item(1).value = Session("ProgramID"
StoredProcParamCollection.item(2).value = Request.Form("BeginDate"
StoredProcParamCollection.item(3).value = Request.Form("EndDate"
Session("oRpt".ReadRecords
Seems pretty straint forward. If effect, this should change the database the report points to. The problem is, it isn't.It still goes to the existing development database and retrieves the information. My asp calls a stored procedure and passes it parameters. I have lot's with subreports, but if I can get the database to change, the rest is elementary.
I am using cr version 7 and ms sqlserver 7. Is there something in the report that needs to be set?
Any ideas??
NordicMan