CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Oct 2013

    Crystal Report still show database login prompt after using .setdatabaselogon

    hi im currently developing vb.net program using vs2012 and crystal report for vs service pack 6, i got issue when im try to load report when running the program it use odbc name as server name and keep showing database login prompt even after i set server name in code , the report run fine if i using report preview in ide.

    this is the code i'm using to load the crystal report

    Dim report As New ReportDocument()
    report.Load(Application.StartupPath & "\Report\BACK OFFICE\lprinventory.rpt")
    report.SetDatabaseLogon("sa", "424378", "LAPTOP", "COZY")
    CrystalReportViewer1.ReportSource = report

    Surya Halim

    Sorry for bad english

  2. #2
    Join Date
    Jul 2005

    Re: Crystal Report still show database login prompt after using .setdatabaselogon

    I use the next code
      Public CRReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
      Public CRTable As CrystalDecisions.CrystalReports.Engine.Table
      Public CRTLI As CrystalDecisions.Shared.TableLogOnInfo
      'some procedure
      CRReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
      CRReport.Load(GRutaRpts & "MyReport.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
      For Each Module1.CRTable In CRReport.Database.Tables
        CRTLI = CRTable.LogOnInfo
        With CRTLI.ConnectionInfo
           .ServerName = "MyDSNName"
           .UserID = "MyUserName"
           .Password = "MyPassword"
           .DatabaseName = "MyDBName"
        End With
      Next CRTable

    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.