0
votes

I have the following bit of simple code, which based on tutorials should work:

Try
   Dim report As CustomerStatus = New CustomerStatus
   report.Load("Reports/CustomerStatus.rpt")

   report.SetParameterValue("id_customer", 130)
   report.SetDatabaseLogon("root", "", "localhost", "aerospace")

   report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "c:\customer_status.pdf")

Catch ex As Exception
   MessageBox.Show(ex.Message)
End Try

Regardless of whether I directly connect (SetDatabaseLogon) or use the details specified at report compilation, I get this error:

"Database Logon Failed."

I have also tried connecting to a local and production server and neither works.

I am using Crystal Reports for Visual Studio 2012 Professional.

2
You should show your error details. - Louis van Tonder
How do I get at those? Sorry but it's been over a decade since I seriously used VB.NET so consider me a total newb :) - Alex.Barylski
I am not sure what you are asking? - Louis van Tonder
Well any errors I can see I have included in the first question...no exception is thrown so I am not sure what other error details you are asking for??? How do I see what they are...I only get a dialogbox saying "Database Logon Failed." - Alex.Barylski
I am updating your question to reflect this. - Louis van Tonder

2 Answers

0
votes

Crystal engine sometimes has issues when you use "localhost", try with the actual server name instead

0
votes

I had a similar issue where only certain reports would fail with this error but only on the first run - e.g after the app pool was just started. Subsequent attempt to run the report had no error. As soon as the app pool w3wp.exe process was killed and restarted the error would occur. In my particular case I was running CR2008 (v 12) and the database was SQL Server 2008 R2 located on the same server with the asp.net application running the reports. The ap pool was enabled for 32 bit applications. The solution was to enable the TCPIP connections in the SQL Server Configuration manager. By default only named pipes was enabled. After enabling TCPIP and restarting SQL Server the error went away.