gorgeous
December 13th, 2002, 02:06 AM
For reporting in my ASP.Net application I am using User made intermediate(ActiveX) dll which inturn interacts with the CRAXDRT DLL(Crystal 8.5 RDC Runtime library). When the user selects a report, a vb script file will be created which is executed with WScript.Exe to populate & export the report to a file on the server, this file is then set to the CR Report viewer. My reports are connecting to SQL Server 7 database using native connectivity.
I am able to execute the script but the Crystal object is not able to connect to the database. It gives error "Server has not yet been opened" Error on Application.LogOnInfo method. My SQL Server database is on a separate machine. I've tried with both the name of the machine & the IP address.
Let me explain my code
---- Test.vbs-------
Dim objCrystalLib
'Create Crystal Application object
Set objCrystalLib = CreateObject("CrystlLib.CrystalReport") 'REF: CRAXDRT.DLL, ADODB
'Connect App object to the database(Application.LogOnServer)
objCrystalLib.LogOnServer "P2SSQL.DLL", "Server", "DBName", "UID","PWD"
'Open report (App.OpenReport)
'Connect the database object to actual database(db.LogOnServer)
'SetTableLogOnInfo of tables in the report
objCrystalLib.ReportFileName = "ReportName"
'export the populated report to a disk file (ReportObject.Export)
objCrystalLib.PreviewReport
***********************************************************
It first creates the ActiveX object, then the Crystal Application is connected to the database (SQL Server 7 here). Then name of the report template is passed to the object. In this function it connects each table mentioned in the report to the database. Now the preview function is called to export the populated report to a file on the server.
When I execute this vb script file from my ASP.Net application, the object fails to connect to the database i.e. it gives error at the LogOnServer function call. Initially I thought this might be because some version conflict(Crystal has provided Crystal for Visual Studio .Net and I am using an earlier version). Then I executed the script file from the command line, and then .Net windows application, both are working fine, that means it is not version conflict. There is some thing specific to the web application, may be some security issue or some other setting. I am not able to figure it out. Please help me.
Thank you for your time.
Raseena
I am able to execute the script but the Crystal object is not able to connect to the database. It gives error "Server has not yet been opened" Error on Application.LogOnInfo method. My SQL Server database is on a separate machine. I've tried with both the name of the machine & the IP address.
Let me explain my code
---- Test.vbs-------
Dim objCrystalLib
'Create Crystal Application object
Set objCrystalLib = CreateObject("CrystlLib.CrystalReport") 'REF: CRAXDRT.DLL, ADODB
'Connect App object to the database(Application.LogOnServer)
objCrystalLib.LogOnServer "P2SSQL.DLL", "Server", "DBName", "UID","PWD"
'Open report (App.OpenReport)
'Connect the database object to actual database(db.LogOnServer)
'SetTableLogOnInfo of tables in the report
objCrystalLib.ReportFileName = "ReportName"
'export the populated report to a disk file (ReportObject.Export)
objCrystalLib.PreviewReport
***********************************************************
It first creates the ActiveX object, then the Crystal Application is connected to the database (SQL Server 7 here). Then name of the report template is passed to the object. In this function it connects each table mentioned in the report to the database. Now the preview function is called to export the populated report to a file on the server.
When I execute this vb script file from my ASP.Net application, the object fails to connect to the database i.e. it gives error at the LogOnServer function call. Initially I thought this might be because some version conflict(Crystal has provided Crystal for Visual Studio .Net and I am using an earlier version). Then I executed the script file from the command line, and then .Net windows application, both are working fine, that means it is not version conflict. There is some thing specific to the web application, may be some security issue or some other setting. I am not able to figure it out. Please help me.
Thank you for your time.
Raseena