Results 1 to 3 of 3

Thread: [2005] Crystal report viewer question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Hong Kong
    Posts
    384

    [2005] Crystal report viewer question

    Code:
        Public Sub New(ByVal i As Integer, ByVal typeOfReport As String)
           
            Try
                ' This call is required by the Windows Form Designer.
                InitializeComponent()
                Dim NewReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
                If typeOfReport = "Invoice" Then
                    NewReport = New Invoice
                    NewReport.Load(NewReport.FileName)
                    NewReport.SetParameterValue("iNo", i)
                    NewReport.SetDatabaseLogon("user", "pwd", "mydomain.net:70", "xxx")
                    Me.CrystalReportViewer1.ReportSource = NewReport
                ElseIf typeOfReport = "DI SET" Then
                    NewReport = New DISet
                    NewReport.Load(NewReport.FileName)
                    NewReport.SetParameterValue("diNo", i)
                    NewReport.SetDatabaseLogon("user", "pwd", "mydomain.net:70", "xxx")
                    Me.CrystalReportViewer1.ReportSource = NewReport
                Else
                    MessageBox.Show("Incorrect type of report", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End If
            Catch ex As Exception
                MessageBox.Show( _
                    ex.Message & vbNewLine & _
                    ex.Source & vbNewLine & _
                    ex.StackTrace, "Error", MessageBoxButtons.OK)
            End Try
    here is the code in my crystalreportviewer, and the code of call this form:
    Code:
    Try
                Dim rpt As New ReportViewer(ComboBox1.SelectedItem, "DI SET")
                Main.LoadingForm.Visible = True
                Main.LoadingForm.Value = 50
                Me.Refresh()
                rpt.MdiParent = Main
                Me.Refresh()
                Main.LoadingForm.Value = 100
                rpt.Show()
                Main.LoadingForm.Visible = False
                Me.Close()
            Catch ex As Exception
                MessageBox.Show("Error: " & ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
    Code:
    Try
                Dim rpt As New ReportViewer(ComboBox1.SelectedItem, "Invoice")
                Main.LoadingForm.Visible = True
                Main.LoadingForm.Value = 50
                Me.Refresh()
                rpt.MdiParent = Main
                Me.Refresh()
                Main.LoadingForm.Value = 100
                rpt.Show()
                Main.LoadingForm.Visible = False
                Me.Close()
            Catch ex As Exception
                MessageBox.Show("Error: " & ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
    The question is, when I open the report viewer by calling invoice, it is successfully open, then I close it and open the report viewer by calling "DI SET", this time, a database login form show out and request me to input password, I input the password and press finish, then it tell me "Logon Failed. Please try again"...I sure that the password is correct. The opening report sequence is not changed by calling "DI SET" first, it is successfully, but also, opening by "invoice" is failed.

    This time, I change the computer that the database is builded here. The server name is same...All is going well when I try to open two crystal report viewer.

  2. #2
    New Member
    Join Date
    May 2008
    Posts
    5

    Thumbs up Re: [2005] Crystal report viewer question

    are you sure you getting the reports if you change the order of the reports?
    I don't think there might not be problem with sequence. can you check both report sources are generated with the same "connection drivers". actually starting days i am also getting this type of problem some reports are working and some are not working for the same database and same kind of reports. later while checking i find that. some reports developed by using "SQL native drivers and some one with OLEDB" for me production server does't have the SQL native client then when i browse that reports which are developed by Native Client driver it shows the DB login Dialog box with Datasource disable and password field empty.. later on i changed all my reports to OLEDB connection..now all are working find. check that you also did same mistake ... what kind of data base you are using ? is "DI SET" has any sub reports or ? is it have any some other SQL Expressions ?


    Thanks and Regards
    Ranganadh Kodali
    Last edited by ranganadhkodali; May 5th, 2008 at 08:28 AM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Hong Kong
    Posts
    384

    Re: [2005] Crystal report viewer question

    i find the problem. I forgot to refresh the report, thx

Posting Permissions

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



Click Here to Expand Forum to Full Width