Sunday, March 11, 2012

Crystal Report Parameters

Hi guys, i am new around here, so be gentle!

I am trying to make a crystal report using vb.net 2005. When i add a new item to my website (crystal report) i choose "Add Command". I write the following code:

--------------------
select panathdate from properties where pid=@.id
--------------------

It then asks me to declare @.id. So i write the following:
--------------------
declare @.id integer
select panathdate from properties where pid=@.id
--------------------
and then i add a new parameter named "@.id".

Then, in the code behind of my webpage (after i added a crystalreportviewer) i write the following code:

--------------------
Dim paramField As New ParameterField
Dim pFields As New ParameterFields()
paramField.ParameterFieldName = "@.id"
paramField.CurrentValues.AddValue(Request("id"))
pFields.Add(paramField)

CrystalReportViewer1.ParameterFieldInfo = pFields
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.ReportSource = crReportDocument
--------------------

For some reason, although when i print the @.id it shows the correct number, i cant see the desired record from the database, except a blank report.

Any ideas or a detailed tutorial on how to bring the desired records in the crystal report would be ideal!!

Thanks in advance!Refresh report viewer by calling
CrystalReportViewer1.RefreshReport()
(Please correct the syntax since i am not VB programmer)

No comments:

Post a Comment