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:
Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
CrystalLoad()
Dim crReport As New Finale
'ParameterFieldDefinitions and ParameterFieldDefinition are off the
'CrystalDecisions.CrystalReports.Engine namespace
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
'ParameterValues and ParameterDiscreteValue are off the CrystalDecisions.Shared
'namespace
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
'Set String Parameter
'Set discrete value
crParameterDiscreteValue.Value = ComboSelect
'Access first parameter field definition
crParameterFieldDefinitions = crReport.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("ParamName")
' Add a parameter value
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
' Apply the current value to the parameter definition
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
crv.ReportSource = crReport
End Sub
Private Sub CrystalLoad()
'Connecting to crystal report using with Login INfo
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
'Initializing the report
Dim crReportDocument As New Finale
'Connection Information
With crConnectionInfo
.ServerName = "127.0.0.1"
.DatabaseName = "test"
.UserID = "sa"
.Password = "qw"
End With
CrTables = crReportDocument.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
End Sub
Re: Logging into crystal report
The Connection information for crReport never gets set. Pass the report object to the CrystalLoad procedure.