I use Crystal 9.0 and Oracle DB. Report works OK in Crystal but when I add to application I get a message: Unable to connect: incorrect log on parameters.
I have a number of reports work perfectly with the same code and only this one give a problem.
My code:
Dim myParamValues As New ParameterValues
Dim mydiscreteVal1 As New ParameterDiscreteValue
Dim crExportOptions As ExportOptions
Dim crDiskFileDest As DiskFileDestinationOptions
Dim Fname As String
'Get the report parameters
myParamValues = oRpt.DataDefinition.ParameterFields("ProjNum").CurrentValues
'mydiscreteVal1.Value = Session("SelectedProjects")
mydiscreteVal1.Value = "04-F-1544"
myParamValues.Add(mydiscreteVal1)
oRpt.DataDefinition.ParameterFields("ProjNum").ApplyCurrentValues(myParamValues)
crExportOptions = New ExportOptions
crDiskFileDest = New DiskFileDestinationOptions
'Set the destination path and file name
Fname = "c:\CaseSummary.pdf"
crDiskFileDest.DiskFileName = Fname
'Set export options
crExportOptions = oRpt.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDest
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
oRpt.Export()
'The following code writes the .pdf file to the Client's browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'Delete the exported file from disk.
System.IO.File.Delete(Fname)
I have a number of reports work perfectly with the same code and only this one give a problem.
My code:
Dim myParamValues As New ParameterValues
Dim mydiscreteVal1 As New ParameterDiscreteValue
Dim crExportOptions As ExportOptions
Dim crDiskFileDest As DiskFileDestinationOptions
Dim Fname As String
'Get the report parameters
myParamValues = oRpt.DataDefinition.ParameterFields("ProjNum").CurrentValues
'mydiscreteVal1.Value = Session("SelectedProjects")
mydiscreteVal1.Value = "04-F-1544"
myParamValues.Add(mydiscreteVal1)
oRpt.DataDefinition.ParameterFields("ProjNum").ApplyCurrentValues(myParamValues)
crExportOptions = New ExportOptions
crDiskFileDest = New DiskFileDestinationOptions
'Set the destination path and file name
Fname = "c:\CaseSummary.pdf"
crDiskFileDest.DiskFileName = Fname
'Set export options
crExportOptions = oRpt.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDest
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
oRpt.Export()
'The following code writes the .pdf file to the Client's browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'Delete the exported file from disk.
System.IO.File.Delete(Fname)