Why it doesn't work

Y

Yuriy

Hello! i try to dispay a report using Crystal Report for
vusual studio .NET and recieve a message
[LogOnException: Logon failed.]


There is a code:
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

Dim crReportDocument As home_energy1
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo


Dim crParameterFields As ParameterFields
Dim crParameterField As ParameterField
Dim crParameterValues As ParameterValues
Dim crParameterDiscreteValue As
ParameterDiscreteValue



crReportDocument = New home_energy1()

''Setup the connection information structure to be
used
''to log onto the datasource for the report.
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = "(local)" 'physical server name
.DatabaseName = "EZ"
.UserID = "ezuserid"
.Password = "password"
End With

'Get the table information from the report
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables

'Loop through all tables in the report and apply
the connection
'information for each table.
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo =
crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next

Me.CrystalReportViewer1.ReportSource =
crReportDocument

'Get the collection of parameters from the report
crParameterFields =
CrystalReportViewer1.ParameterFieldInfo

'Access the specified parameter from the collection
crParameterField = crParameterFields.Item
("v_userid")

'Get the current values from the parameter field.
At this point
'there are zero values set.
crParameterValues = crParameterField.CurrentValues

'Set the current values for the parameter field
crParameterDiscreteValue = New
ParameterDiscreteValue()
crParameterDiscreteValue.Value = "111111111"

'Add the first current value for the parameter
field
crParameterValues.Add(crParameterDiscreteValue)
'the new parameter information can be used for the
report.
CrystalReportViewer1.ParameterFieldInfo =
crParameterFields


If anyone khows what is going on please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top