Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon Failed

Status
Not open for further replies.

Samuel12Sam

Programmer
Jun 11, 2003
15
US
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
 
You can try this:

For Each table In crReportDocument.Database.Tables
logonInfo = table.LogOnInfo
table.ApplyLogOnInfo(logonInfo)

Response.Write(table.TestConnectivity & &quot;<br>&quot;)

Next table

If false is written, then something is wrong with connecting to the database. Also the account your application is running under, must have permissions to write into C:\Policy_Excp\ directory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top