CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Hi,
I am trying to use a crystal report in my web application (asp.net 2003 + CR Version 8.5)
I get this error: Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
I think its because this report has more than one datasource. So how can i Logon for a report which has more than one datasource.
Below is my code
Private Sub GetReportData() Try Dim crReportDocument As New ReportDocument Dim ConnInfo As New ConnectionInfo With ConnInfo .ServerName = gbVariables.StrReportServer .DatabaseName = gbVariables.strReportDBName .UserID = gbVariables.strUsrName .Password = gbVariables.strUsrPwd End With crReportDocument.Load(gbVariables.strDocPathFolder + "\" + "XYZ.rpt") Me.CrystalReportViewer1.ParameterFieldInfo.Clear() Dim ParamFields As ParameterFields = Me.CrystalReportViewer1.ParameterFieldInfo 'Set Month Paramter Dim GetMonthValues As Int16 GetMonthValues = Session("Month") Dim Per As New ParameterField Per.ParameterFieldName = "@Month" Dim Month_Value As New ParameterDiscreteValue Month_Value.Value = GetMonthValues Per.CurrentValues.Add(Month_Value) ParamFields.Add(Per) Me.CrystalReportViewer1.ParameterFieldInfo = ParamFields Me.CrystalReportViewer1.ReportSource = crReportDocument crReportDocument.SetDatabaseLogon(gbVariables.strUsrName, gbVariables.strUsrPwd, gbVariables.StrReportServer, gbVariables.strReportDBName) Me.CrystalReportViewer1.RefreshReport() CrystalReportViewer1.Visible = True Catch ex As Exception lblError.Text = ex.Message.ToString End Try End Sub
This is how i currently loginto database
crReportDocument.SetDatabaseLogon(gbVariables.strUsrName, gbVariables.strUsrPwd, gbVariables.StrReportServer, gbVariables.strReportDBName)
Thanks to help.