Hello, I have CrystalReport with 2 input parameters StartDate &
EndDate. When I run this report in Preview in VS2005 environment,
everything is fine, I get a dialog windows asking to provide input
parameters. When I run it from the application - it doesn't ask for
parameters.
In the application I had to modify connection information to connect
to different sql servers in different environments (DEV, TEST, PROD).
And here I have 2 questions:
1) Why method myReport.SetDatabaseLogon("username", "password",
"server", "database") DOES NOT WORK? Never. Does not change server and
database. IT IS A BUG, RIGHT?
2) Because method above doesn't work, I had to write a bunch of code
to change connection information like this:
Public Sub RunReport()
Dim rpt As New TestReport
Dim cap As String = "Test Report"
Dim cinfo As ConnectionInfo = New ConnectionInfo
cinfo.ServerName = "SERVER1"
cinfo.DatabaseName = "DATABASE1"
cinfo.UserID = "USERNAME1"
cinfo.Password = "PASSWORD1"
SetDBLogonForReport(cinfo, rpt)
Dim viewer As New ReportViewerForm(rpt, cap)
Me.mdiParent.ActivateChildForm(viewer)
End Sub
Private Sub SetDBLogonForReport(ByVal cinfo As ConnectionInfo, ByVal
rpt As ReportDocument)
For Each tbl As CrystalDecisions.CrystalReports.Engine.Table In
rpt.Database.Tables
Dim loginfo As TableLogOnInfo = tbl.LogOnInfo
loginfo.ConnectionInfo = cinfo
tbl.ApplyLogOnInfo(loginfo)
Next
End Sub
What happens when I run the report from the application - connection
information is changed, but the report doesn't ask for input
parameters at all. No Input Parameters Dialog box appear.
I anyone had a similar problem and knows the resolution, please help.
Thanks.