I am using Crystal Reports for Visual Studio 2010.
I want to prompt for some input from my .aspx page and allow the user to click a botton to run the report.
The following code works from the Page_Load subroutine but when I try to run the code from the click event of the button. I answer my Crystal parameter prompt and the report page displays the message:
"No valid report source is available."
Here is the visual basic code:
Protected Sub PreviewLabels_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PreviewLabels.Click
If (Session("report") Is Nothing) Then
Dim rd As New ReportDocument
rd.Load(Server.MapPath("ExpirationNoticesMailingLabels.rpt"))
Dim boConnectionInfo As CrystalDecisions.Shared.IConnectionInfo
For Each boConnectionInfo In rd.DataSourceConnections
boConnectionInfo.SetLogon("Username", "Password")
Next
Session.Add("report", rd)
End If
CrystalReportViewer1.ReportSource = Session("report")
End Sub