Crystal Report Logon Fail

Aidanb79

Member
Joined
Feb 14, 2010
Messages
10
Programming Experience
Beginner
Hi All,

I am really struggling getting a crystal report to load i can get it to load on the development machine but when i load it to a client machine it asks for the Logon Info and have tried to get this to work around to no success.

Here is what i have so far;
VB.NET:
Private Sub CmdView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdView.Click
        Dim cryRpt As New ReportDocument
        'cryRpt.Load(Application.StartupPath + "Invoice.rpt")
        cryRpt.Load(Application.StartupPath + "\Report\CrystalReport1.rpt")
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue
     

        Dim myTableLogonInfos = New CrystalDecisions.Shared.TableLogOnInfos()
        Dim myTableLogonInfo = New CrystalDecisions.Shared.TableLogOnInfo()
        Dim myConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo()


        Try
            With myConnectionInfo
                '.ServerName = "localhost"
                .DatabaseName = ConnString
                .UserID = "Admin"
                .Password = ""
            End With

            myTableLogonInfo.ConnectionInfo = myConnectionInfo
            'myTableLogonInfo.TableName = "customers"
            myTableLogonInfos.Add(myTableLogonInfo)
            CrystalReportViewer1.LogOnInfo = myTableLogonInfos

            crParameterDiscreteValue.Value = Convert.ToInt32(InvoiceNumber)
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
            crParameterFieldDefinition = crParameterFieldDefinitions.Item("InvoiceNum")
            crParameterValues = crParameterFieldDefinition.CurrentValues




            crParameterValues.Clear()
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

            CrystalReportViewer1.ReportSource = cryRpt
            CrystalReportViewer1.Refresh()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Hope someone can help me and others that have this problem.

Thanks in advance

Aidan
 

Latest posts

Back
Top