Click here to Skip to main content
16,003,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
im new to crystal report how to create a report using data from session plz help me
Posted
Comments
Sergey Alexandrovich Kryukov 29-Mar-12 0:47am    
Not clear.
--SA

1 solution

If you give brief detail of your question. we can understand it better.
----------------------------------------------------------------------
but as for your this question:-

save the data retrieved from session in an varaible.

use the parameters in crystal reports for text fields and parameters fields.

Try this code for showing the data in parameters:-

Declarative :-

C#
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportSource;


code part:-

Objects Declarations:-

ParameterFields paramFields = new ParameterFields();
ParameterField paramField;
ParameterDiscreteValue paramDiscreteValue;
Inq_Report2 objRpt;

use this function:-

'int i' refers to parameters no., and 'string e' refers to the value which you want to show.

C#
public void runtime_param(int i, string e)
       {
           paramField = new ParameterField();
           paramField.Name = "col" + i.ToString();
           paramDiscreteValue = new ParameterDiscreteValue();
           paramDiscreteValue.Value = e;
           paramField.CurrentValues.Add(paramDiscreteValue);
           //Add the paramField to paramFields
           paramFields.Add(paramField);
       }


on
void button1_click()
{
runtime_param(3, "session data");
crystalReportViewer1.ParameterFieldInfo = paramFields;
where 'ds' is a dataset if you want to use.
C#
objRpt.SetDataSource(ds);
            crystalReportViewer1.ReportSource = objRpt;
            con.Close();

}

-------------------------------------------------------------------------------

if you have any problem just tell.
Good Regards for your problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900