Skip to Content
0
Former Member
Jul 17, 2009 at 07:30 PM

Unable to connect: incorrect log on parameters.

43 Views

In my web page I have the following code to load a crystal report and apply the login details.

It works fine in the development Windows 2003 pc, but when I publish it in a virtual directory on the same pc I get the following error.

MyAppLogon failed. Error in File test_rep {05997100-DCAD-4577-A295-C176916BA981}.rpt: Unable to connect: incorrect log on parameters.

I have another development XP pc with the same setup and everything works fine.

Could any one tell me why it's not working? I am convinced that this is a permission problem on the pc. It seems like the web site cannot find the tnsnames.org file in the oracle directry, even though I have given all users including ast.net access to the folder.

Any help is greatly appreciated. I have VS2005 and Crystal 2008

Following in my code:

myReport = New ReportDocument

myReport.Load(reportPath)

Dim crLogin As New ApplyCRLogin

crLogin._userID = "dwois"

crLogin._passWord = "dwois"

crLogin._serverName = "DW Prod Virtuo"

crLogin.ApplyInfo(myReport)

crLogin = Nothing

Public Class ApplyCRLogin

Public _dbName As String

Public _serverName As String

Public _userID As String

Public _passWord As String

Public _integratedSecurity As Boolean

Public Sub ApplyInfo(ByRef _oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)

Dim oCRDb As CrystalDecisions.CrystalReports.Engine.Database = _oRpt.Database()

Dim oCRTables As CrystalDecisions.CrystalReports.Engine.Tables = oCRDb.Tables()

Dim oCRTable As CrystalDecisions.CrystalReports.Engine.Table

Dim oCRTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo

Dim oCRConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

'oCRConnectionInfo.DatabaseName = _dbName

'oCRConnectionInfo.ServerName = _serverName

'oCRConnectionInfo.UserID = _userID

'oCRConnectionInfo.Password = _passWord

oCRConnectionInfo.DatabaseName = _dbName

oCRConnectionInfo.ServerName = _serverName

oCRConnectionInfo.UserID = _userID

oCRConnectionInfo.Password = _passWord

oCRConnectionInfo.IntegratedSecurity = _integratedSecurity

For Each oCRTable In oCRTables

oCRTableLogonInfo = oCRTable.LogOnInfo()

oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo

oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)

If (oCRTable.Location.IndexOf(".")) > 0 Then

oCRTable.Location = oCRTable.Location.Substring(oCRTable.Location.LastIndexOf(".") + 1)

Else

oCRTable.Location = oCRTable.Location

End If

Next

oCRTables(0).TestConnectivity()

End Sub

End Class

Edited by: Don Perera on Jul 17, 2009 9:30 PM