Results 1 to 2 of 2

Thread: Logging into crystal report

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2004
    Posts
    610

    Logging into crystal report

    hey guyz.. i already got this login into crystal report.. but when i want to send the data over... it request for my login information agian.

    the autorization box is in the private sub crystalload()
    the passing the string to the report is in btnGenerate_Click

    here is the code.. pls help me out.. thx

    VB Code:
    1. Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
    2.  
    3.         CrystalLoad()
    4.  
    5.  
    6.         Dim crReport As New Finale
    7.  
    8.         'ParameterFieldDefinitions and ParameterFieldDefinition are off the
    9.         'CrystalDecisions.CrystalReports.Engine namespace
    10.         Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    11.         Dim crParameterFieldDefinition As ParameterFieldDefinition
    12.  
    13.         'ParameterValues and ParameterDiscreteValue are off the CrystalDecisions.Shared
    14.         'namespace
    15.         Dim crParameterValues As New ParameterValues
    16.         Dim crParameterDiscreteValue As New ParameterDiscreteValue
    17.  
    18.         'Set String Parameter
    19.  
    20.         'Set discrete value
    21.         crParameterDiscreteValue.Value = ComboSelect
    22.  
    23.         'Access first parameter field definition
    24.         crParameterFieldDefinitions = crReport.DataDefinition.ParameterFields
    25.         crParameterFieldDefinition = crParameterFieldDefinitions.Item("ParamName")
    26.  
    27.         ' Add a parameter value
    28.         crParameterValues = crParameterFieldDefinition.CurrentValues
    29.  
    30.         crParameterValues.Add(crParameterDiscreteValue)
    31.  
    32.         ' Apply the current value to the parameter definition
    33.         crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    34.  
    35.         crv.ReportSource = crReport
    36.  
    37.     End Sub
    38.  
    39.  
    40.     Private Sub CrystalLoad()
    41.  
    42.         'Connecting to crystal report using with Login INfo
    43.         Dim crtableLogoninfos As New TableLogOnInfos
    44.         Dim crtableLogoninfo As New TableLogOnInfo
    45.         Dim crConnectionInfo As New ConnectionInfo
    46.         Dim CrTables As Tables
    47.         Dim CrTable As Table
    48.         Dim TableCounter
    49.  
    50.         'Initializing the report
    51.         Dim crReportDocument As New Finale
    52.  
    53.         'Connection Information
    54.         With crConnectionInfo
    55.             .ServerName = "127.0.0.1"
    56.             .DatabaseName = "test"
    57.             .UserID = "sa"
    58.             .Password = "qw"
    59.  
    60.         End With
    61.  
    62.         CrTables = crReportDocument.Database.Tables
    63.         For Each CrTable In CrTables
    64.             crtableLogoninfo = CrTable.LogOnInfo
    65.             crtableLogoninfo.ConnectionInfo = crConnectionInfo
    66.             CrTable.ApplyLogOnInfo(crtableLogoninfo)
    67.         Next
    68.  
    69.     End Sub

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Logging into crystal report

    The Connection information for crReport never gets set. Pass the report object to the CrystalLoad procedure.

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