Hello,
I have a crystal report (written in CR 2013 Pro), and a Visual Studio Pro 2013 console application using the CR for VS dlls to simply export the CR as a PDF. When I hardcode the console application to provide the report the necessary login credentials, the PDF is successfully produced. When I attempt to pass a variable credential to the same server that the crystal was originally written to connect to, it works. It's when I try to change the server name and database that it fails.
Below is based off of adding snippets from other questions. I remarked them out - again - works fine with using same Servername as what I used in CR designer, but it fails on the .VerifyDatabase() when I edit variable ServerName.
With crConnectionInfo
.ServerName = ServerName
.Password = PWord
.UserID = UserID
.DatabaseName = DbName
End With
With customerReport
If (DebugStatementsOnOutput = 1) Then
returnValue = 3
End If
.Load(reportPath)
If (DebugStatementsOnOutput = 1) Then
returnValue = 4
End If
.SetDatabaseLogon(UserID, PWord, ServerName, DbName)
'For Each crTable As Table In .Database.Tables
' .SetDatabaseLogon(UserID, PWord, ServerName, DbName)
'Next
'For Each subReport As ReportDocument In .Subreports
' For Each crTable As Table In subReport.Database.Tables
' .SetDatabaseLogon(UserID, PWord, ServerName, DbName)
' Next
'Next
If (DebugStatementsOnOutput = 1) Then
returnValue = 41
End If
.VerifyDatabase()
If (DebugStatementsOnOutput = 1) Then
returnValue = 5
End If