Skip to Content
0
Former Member
Feb 05, 2011 at 04:19 AM

CrystalDecisions.CrystalReports.Engine.LogOnException

355 Views

Error scenario:

The aplication is WindowsForms based

I have a crystal report with 4 subreports, by visual basic code I'm Setting Up the connection properties of the database and the parameters of the subreports.

In local mode my application works fine, but when used on a network fails with error CrystalDecisions.CrystalReports.Engine.LogOnException

Here is the code used

Dim crParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue
Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim crParameterFieldLocation As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim oConexInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim crParameterValues As CrystalDecisions.Shared.ParameterValues
Dim cr_Reporte As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim mySubRepDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oConexInfo.ConnectionInfo.ServerName = servername
oConexInfo.ConnectionInfo.DatabaseName = "theDatabase"
oConexInfo.ConnectionInfo.UserID = "user"
oConexInfo.ConnectionInfo.Password = "password"
cr_Reporte.Load(path_server & "rptFacturaCompra.rpt")
For x = 0 To cr_report.Database.Tables.Count - 1
     cr_reporte.Database.Tables(x).ApplyLogOnInfo(oConexInfo)
     cr_reporte.Database.Tables(x).ApplyLogOnInfo(oConexInfo)
Next
crParameterFieldDefinitions = cr_Reporte.DataDefinition.ParameterFields
For index = 0 To cr_Reporte.ReportDefinition.Sections.Count - 1
    For intCounter = 0 To cr_Reporte.ReportDefinition.Sections(index).ReportObjects.Count - 1
       With cr_Reporte.ReportDefinition.Sections(index)
        If .ReportObjects(intCounter).Kind = CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then
           mySubReportObject = CType(.ReportObjects(intCounter), crystalDecisions.CrystalReports.Engine.SubreportObject)
           mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
           crParameterFieldDefinitions = mySubRepDoc.DataDefinition.ParameterFields
           crParameterFieldLocation = crParameterFieldDefinitions.Item(0)
           crParameterValues = crParameterFieldLocation.CurrentValues
           crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
           crParameterDiscreteValue.Value = TheParameterFilterValue
           For x = 0 To cr_report.Database.Tables.Count - 1
                 mySubRepDoc.Database.Tables(x).ApplyLogOnInfo(oConexInfo)
                 mySubRepDoc.Database.Tables(x).ApplyLogOnInfo(oConexInfo)
          Next
        End If
      End With
   Next
Next
cr_Reporte.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4
cr_Reporte.PrintToPrinter(2, True, 1, 1)

Full Error data:

CrystalDecisions.CrystalReports.Engine.LogOnException:

Error en archivo C:DOCUME1ADMINI1CONFIG~1TempFacturaVenta {0D0348F4-954B-4BEA-BA77-AC070CE8D668}.rpt:

No se puede conectar: parámetros de conexión incorrectos. ---> System.Runtime.InteropServices.COMException (0x8004100F):

Error en archivo C:DOCUME1ADMINI1CONFIG~1TempFacturaVenta {0D0348F4-954B-4BEA-BA77-AC070CE8D668}.rpt:

No se puede conectar: parámetros de conexión incorrectos.

en CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetLastPageNumber(RequestContext pRequestContext)

en CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext reqContext)