KarthikBala
Programmer
I am working on Oracle8i,VB6,ASP and Crystal Reports 8.5.
I have created reports using ODBC driver to access Oracle8i Procedures(Package and Procedures).
When I export my report from VB Component using the method
objReport.Export FALSE
I am getting the following error message
(only when I invoke the method "objReport.Export True"
"Server not yet been opened
Run-time error '-2147192184(80047288)':"
I have created reports using CROR8V36 under ODBC option
in Report Designer for Database Connection.
Anything Wrong in the Code:
Public Function GenerateReport(ByVal ServerName, As String, ByVal UserId As String, _
ByVal Password As String) As String
On Error GoTo vbwErrHandler
Dim StrTargetFileName As String
Dim StrReportSQL As String
Dim CRApplication As CRAXDRT.Application
Dim CRReport As CRAXDRT.Report
Dim crFormulaField As CRAXDRT.FormulaFieldDefinition
Dim crParameterFields As CRAXDRT.ParameterFieldDefinitions
Dim crParameterField As CRAXDRT.ParameterFieldDefinition
Dim intIndex As Integer
Dim StrTempSQL As String
Dim strTemp As String
Dim intProductId As Integer
intProductId = 105
Set CRApplication = New CRAXDRT.Application
Set CRReport = CRApplication.OpenReport("D:\Test.rpt"
'Log on to the Tracit database
With CRReport.Database
.LogOnServer "pdsora7.dll", ServerName, , UserId, Password
.Verify
End With
CRReport.EnableParameterPrompting = False
StrTargetFileName = "D:\Test" & ".Pdf"
Set crParameterFields = CRReport.ParameterFields
For intIndex = 1 To crParameterFields.Count
Set crParameterField = crParameterFields(intIndex)
Select Case UCase(crParameterField.Name)
Case "{?PRODUCT_ID}"
crParameterField.AddCurrentValue (CLng(intProductId))
End Select
Next intIndex
With CRReport.ExportOptions
.DiskFileName = StrTargetFileName
.DestinationType = crEDTDiskFile
.PDFExportAllPages = True
.FormatType = crEFTPortableDocFormat
End With
CRReport.Export False
Set CRReport = Nothing
Set crParameterField = Nothing
Set crParameterFields = Nothing
CRApplication.LogOffServer "pdsora7.dll", ServerName, , UserId, Password
Set CRApplication = Nothing
GenerateReport = StrTargetFileName
Exit Function
vbwErrHandler:
Err.Raise Err.Number, Err.Source, Err.Description
End Function
Thanks
Karthik Bala
I have created reports using ODBC driver to access Oracle8i Procedures(Package and Procedures).
When I export my report from VB Component using the method
objReport.Export FALSE
I am getting the following error message
(only when I invoke the method "objReport.Export True"
"Server not yet been opened
Run-time error '-2147192184(80047288)':"
I have created reports using CROR8V36 under ODBC option
in Report Designer for Database Connection.
Anything Wrong in the Code:
Public Function GenerateReport(ByVal ServerName, As String, ByVal UserId As String, _
ByVal Password As String) As String
On Error GoTo vbwErrHandler
Dim StrTargetFileName As String
Dim StrReportSQL As String
Dim CRApplication As CRAXDRT.Application
Dim CRReport As CRAXDRT.Report
Dim crFormulaField As CRAXDRT.FormulaFieldDefinition
Dim crParameterFields As CRAXDRT.ParameterFieldDefinitions
Dim crParameterField As CRAXDRT.ParameterFieldDefinition
Dim intIndex As Integer
Dim StrTempSQL As String
Dim strTemp As String
Dim intProductId As Integer
intProductId = 105
Set CRApplication = New CRAXDRT.Application
Set CRReport = CRApplication.OpenReport("D:\Test.rpt"
'Log on to the Tracit database
With CRReport.Database
.LogOnServer "pdsora7.dll", ServerName, , UserId, Password
.Verify
End With
CRReport.EnableParameterPrompting = False
StrTargetFileName = "D:\Test" & ".Pdf"
Set crParameterFields = CRReport.ParameterFields
For intIndex = 1 To crParameterFields.Count
Set crParameterField = crParameterFields(intIndex)
Select Case UCase(crParameterField.Name)
Case "{?PRODUCT_ID}"
crParameterField.AddCurrentValue (CLng(intProductId))
End Select
Next intIndex
With CRReport.ExportOptions
.DiskFileName = StrTargetFileName
.DestinationType = crEDTDiskFile
.PDFExportAllPages = True
.FormatType = crEFTPortableDocFormat
End With
CRReport.Export False
Set CRReport = Nothing
Set crParameterField = Nothing
Set crParameterFields = Nothing
CRApplication.LogOffServer "pdsora7.dll", ServerName, , UserId, Password
Set CRApplication = Nothing
GenerateReport = StrTargetFileName
Exit Function
vbwErrHandler:
Err.Raise Err.Number, Err.Source, Err.Description
End Function
Thanks
Karthik Bala