Samuel12Sam
Programmer
I get the Logon Failed message at this line
crReportDocument.Export()
please have a look at the code. thanx for your help and time.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim crReportDocument As New ReportDocument()
Dim crExportOptions As CrystalDecisions.Shared.ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim pdfRtfWordOpts As New PdfRtfWordFormatOptions()
crReportDocument = New Policy_Excp_Subreport()
Dim logonInfo As New TableLogOnInfo()
Dim table As Table
logonInfo.ConnectionInfo.ServerName = "D_CMP"
logonInfo.ConnectionInfo.DatabaseName = "GA016TBA"
logonInfo.ConnectionInfo.UserID = "cmpdev"
logonInfo.ConnectionInfo.Password = "cmpdev"
For Each table In crReportDocument.Database.Tables
logonInfo = table.LogOnInfo
table.ApplyLogOnInfo(logonInfo)
Next table
Dim Fname As String
Fname = "C:\Policy_Excp" & ".pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.FormatOptions = pdfRtfWordOpts
End With
crReportDocument.Export()
iNoOfPages = pdfRtfWordOpts.LastPageNumber()
'The following code writes the pdf file to the Client’s browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
'Response.Write(CStr(iNoOfPages))
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'Delete the exported file from disk
System.IO.File.Delete(Fname)
End Sub
crReportDocument.Export()
please have a look at the code. thanx for your help and time.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim crReportDocument As New ReportDocument()
Dim crExportOptions As CrystalDecisions.Shared.ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim pdfRtfWordOpts As New PdfRtfWordFormatOptions()
crReportDocument = New Policy_Excp_Subreport()
Dim logonInfo As New TableLogOnInfo()
Dim table As Table
logonInfo.ConnectionInfo.ServerName = "D_CMP"
logonInfo.ConnectionInfo.DatabaseName = "GA016TBA"
logonInfo.ConnectionInfo.UserID = "cmpdev"
logonInfo.ConnectionInfo.Password = "cmpdev"
For Each table In crReportDocument.Database.Tables
logonInfo = table.LogOnInfo
table.ApplyLogOnInfo(logonInfo)
Next table
Dim Fname As String
Fname = "C:\Policy_Excp" & ".pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.FormatOptions = pdfRtfWordOpts
End With
crReportDocument.Export()
iNoOfPages = pdfRtfWordOpts.LastPageNumber()
'The following code writes the pdf file to the Client’s browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
'Response.Write(CStr(iNoOfPages))
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'Delete the exported file from disk
System.IO.File.Delete(Fname)
End Sub