Skip to Content
0
Former Member
Feb 23, 2011 at 07:29 PM

Problem trying to display data from SQL Server 2005 - DB Vendor code 18456

46 Views

Hi,

I have a web application developed in VS .NET 2003 and we get reports from the DB using CR2008 SP2. When I executed the report I get the following error:

Logon failed. Details: [Database Vendor Code: 18456 ] Database Connector Error: ' [Database Vendor Code: 18456 ]' Failed to open the connection. Details: [Database Vendor Code: 18456 ] Error in File temp_3d209d8b-6584-4d15-84ab-8419f151c37c {6DC9EB25-25C3-4159-8896-A94570C96C88}.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]

The weird thing is that sometimes the report works and after trying to execute a different search with a different filter it crashes and the previous search that worked at the beginning no longer works.

I tried to apply different workarounds like creating a class to logon to CR every time my page loads but it didn't work. Here is the code:

Public Shared Sub CRCrystalLogon(ByRef rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)

''CrystalReport1' must be the name the CrystalReport

Dim crTableLogOnInfo As TableLogOnInfo = New TableLogOnInfo

Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo

'Crystal Report Properties

Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database

Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables

Dim crTable As CrystalDecisions.CrystalReports.Engine.Table

'Then, use following code sample to add the logic in the Page_Load method of your Web Form:

crConnectionInfo.ServerName = "SERVER"

crConnectionInfo.DatabaseName = "DB"

crConnectionInfo.UserID = "sa"

crConnectionInfo.Password = "pwd"

crDatabase = rpt.Database

crTables = crDatabase.Tables

For Each crTable In crTables

crTableLogOnInfo = crTable.LogOnInfo

crTableLogOnInfo.ConnectionInfo = crConnectionInfo

crTable.ApplyLogOnInfo(crTableLogOnInfo)

Next

End Sub

Please help me with this.