Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Database logon error for crystal report...

Database logon error for crystal report...

Scheduled Pinned Locked Moved Web Development
helpdatabase
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VB Net Developer
    wrote on last edited by
    #1

    I am saving crystal report as pdf in my machine using pull method.... it was working fine till i added refresh() as it was not refreshing the data.. i am gettin error as Database Logon failed and in inner exception i am getting CrystalDecisions.ReportAppServer.DataSetConversion.... Below is my code...pls help Dim rptExcel As New ReportDocument rptExcel.Load("MrRpt.rpt") rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile rptExcel.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat Dim objOptions11 As DiskFileDestinationOptions = New DiskFileDestinationOptions objOptions11.DiskFileName = strExportFile rptExcel.ExportOptions.DestinationOptions = objOptions11 rptExcel.Refresh() rptExcel.Export()//Here it throws error rptExcel.Dispose()

    L 1 Reply Last reply
    0
    • V VB Net Developer

      I am saving crystal report as pdf in my machine using pull method.... it was working fine till i added refresh() as it was not refreshing the data.. i am gettin error as Database Logon failed and in inner exception i am getting CrystalDecisions.ReportAppServer.DataSetConversion.... Below is my code...pls help Dim rptExcel As New ReportDocument rptExcel.Load("MrRpt.rpt") rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile rptExcel.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat Dim objOptions11 As DiskFileDestinationOptions = New DiskFileDestinationOptions objOptions11.DiskFileName = strExportFile rptExcel.ExportOptions.DestinationOptions = objOptions11 rptExcel.Refresh() rptExcel.Export()//Here it throws error rptExcel.Dispose()

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I think you are missing following code (for authenticating crystal report for accessing sql server data) or there is some problem in authentication.

      Dim oReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
      oReport.Load(reportName)
      DoCRLogin(oReport)

      Public Sub DoCRLogin(ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
      Dim _applyLogin As New ApplyCRLogin

          ' use ApplyLogin object to apply login info to all tables in CR object
          \_applyLogin.\_dbName = "Northwind"
          \_applyLogin.\_passWord = "CrystalUser"
          \_applyLogin.\_serverName = "(local)"
          \_applyLogin.\_userID = "CrystalUser"
          \_applyLogin.ApplyInfo(oRpt)
      
      
          ' clean up
          \_applyLogin = Nothing
      End Sub
      

      Public Class ApplyCRLogin
      Public _dbName As String
      Public _serverName As String
      Public _userID As String
      Public _passWord As String
      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
      For Each oCRTable In oCRTables
      oCRTableLogonInfo = oCRTable.LogOnInfo
      oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo
      oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)

          Next
      End Sub
      

      Find following link useful for more help... http://aspalliance.com/532_Understanding_the_Login_Failed_Error_in_Crystal_Reports.all[^] http://aspalliance.com/490_Troubleshooting_Database_Login_Errors_using_Crystal_Reports_with_NET.all[

      V 1 Reply Last reply
      0
      • L Lost User

        I think you are missing following code (for authenticating crystal report for accessing sql server data) or there is some problem in authentication.

        Dim oReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
        oReport.Load(reportName)
        DoCRLogin(oReport)

        Public Sub DoCRLogin(ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
        Dim _applyLogin As New ApplyCRLogin

            ' use ApplyLogin object to apply login info to all tables in CR object
            \_applyLogin.\_dbName = "Northwind"
            \_applyLogin.\_passWord = "CrystalUser"
            \_applyLogin.\_serverName = "(local)"
            \_applyLogin.\_userID = "CrystalUser"
            \_applyLogin.ApplyInfo(oRpt)
        
        
            ' clean up
            \_applyLogin = Nothing
        End Sub
        

        Public Class ApplyCRLogin
        Public _dbName As String
        Public _serverName As String
        Public _userID As String
        Public _passWord As String
        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
        For Each oCRTable In oCRTables
        oCRTableLogonInfo = oCRTable.LogOnInfo
        oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo
        oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)

            Next
        End Sub
        

        Find following link useful for more help... http://aspalliance.com/532_Understanding_the_Login_Failed_Error_in_Crystal_Reports.all[^] http://aspalliance.com/490_Troubleshooting_Database_Login_Errors_using_Crystal_Reports_with_NET.all[

        V Offline
        V Offline
        VB Net Developer
        wrote on last edited by
        #3

        Still i get the same error....

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups