Paging through Crystal Report gives 'Logon Failed'. Why?

Posted on 2005-04-18
Medium Priority
Last Modified: 2008-03-10
I have produced a vb.net application that uses the bundled Crystal Reports.
My data comes from a dataset, which is pulled out of an SQL database.
I'm using datasets as the product will be distributed to many sites.
So after much trial and error I have used ADO.Net datasets for the reports database, which just defines my fields via XML.
The report is displayed nicely in the viewer, regardless of the server being used, until I go and try and page through the report or print it.
I get the 'logon failed' popup. Why? If the data is coming out of a dataset, why do I have to logon to anything specifically for the report.
I have gone down the track of trying to pass logoninfo, but then I get the database logon dialog popup before the report starts (which is empty).

I use these statements (which seem fine)

                rptInd.Load(Application.StartupPath & "\rptDetails.rpt")

Tried both of these...same results

set the viewer source with.
           crvReport.ReportSource = rptInd

Can some one tell me where I go from here. From what i have read the error is deceptive.

I just want to say, I though the reports in VB6 were a headache, but CR ups that to migraine.
Question by:Milkus1
  • 2
LVL 27

Expert Comment

ID: 13814930

 Imports System.IO
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared

    Public myReport As New ReportDocument        'Gobal Report Doc

   Private Sub GetReportConnection(ByVal myReport)
        ' Objects used to set the proper database connection information
        Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
        Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

            ' Load the report
            myReport.Load(sAppPath & sReportPath & sReportName, CrystalDecisions.[Shared].OpenReportMethod.OpenReportByTempCopy)
            ' Set the connection information for all the tables used in the report
            For Each tbCurrent In myReport.Database.Tables
                tliCurrent = tbCurrent.LogOnInfo
                With tliCurrent.ConnectionInfo
                    .ServerName = sDBServer
                    .UserID = sUSERid
                    .Password = ""
                    .DatabaseName = sDBName
                End With
            Next tbCurrent
        Catch Exp As LoadSaveReportException
            MsgBox("Incorrect path for loading report.", _
                    MsgBoxStyle.Critical, "Load Report Error")
        Catch Exp As Exception
            MsgBox(Exp.Message & "   in GetReportConnection Procedure", MsgBoxStyle.Critical, "General Error")
        End Try
    End Sub

Author Comment

ID: 13820146
Thanks...I have seen this code before and tried it to no avail.
All this does is changes the popup to the 'database' login dialog rather then just the 'logon failed'
If the report is only one page then everything is great.
Soon as it generates a 2 page or more report, the problem occurs.

I've upped the points as I need an answer quickly.


Author Comment

ID: 13821525
I found the answer!
I was disposing of the report too early.
Therefore it displayed the first page but when it went to requery it for the other pages i had disposed of it.
Thanks for the input, but not sure what to do with the points ...

Accepted Solution

CetusMOD earned 0 total points
ID: 13853208
PAQ'd, 500 points refunded.
Community Support Moderator

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question