passing parameter from asp.net to crystal report
I have a crystal report that takes in a single parameter(discrete value) of string data type.
i have to integrate this report with the aspx page.In the aspx form i have a dropdown that holds the parameter values which is passed to the crystal report.
Now depending on the selected item from the dropdown i have to display the records in the report.
This report in the crystal report environment works fine(as in is intended to), and returns the correct number of records.
But when the same report is integrated with the aspx page.
The records repeat itself 4 times for parameters and one of the formula field doesn't display the data at all.
i could not figure out what the problem is.
any help is highly appreciated.
the following is the code that i have written while passing the paremeters.
Dim crpt As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
crpt.Load(Server.MapPath("cr_reports/tpa_receivables-Programmewise.rpt")
Dim paramfields As New CrystalDecisions.Shared.ParameterFields()
Dim paramfield As New CrystalDecisions.Shared.ParameterField()
Dim discrtvalue As New CrystalDecisions.Shared.ParameterDiscreteValue()
Dim newlogoninfo As New CrystalDecisions.Shared.TableLogOnInfo()
Dim crtable As CrystalDecisions.CrystalReports.Engine.Table
newlogoninfo.ConnectionInfo.ServerName = Application("servername")
newlogoninfo.ConnectionInfo.DatabaseName = Application("dbname")
newlogoninfo.ConnectionInfo.UserID = Application("dbuser")
newlogoninfo.ConnectionInfo.Password = Application("dbpwd")
For Each crtable In crpt.Database.Tables
crtable.ApplyLogOnInfo(newlogoninfo)
Next
discrtvalue.Value = dropdownlst.selecteditem.value
paramfield.ParameterFieldName = "myfieldname"
paramfield.CurrentValues.Add(discrtvalue)
paramfields.Add(paramfield)
CrystalReportViewer1.ParameterFieldInfo = paramfields
CrystalReportViewer1.ReportSource = crpt
|