vaquas khan

vaquas khan

  • NA
  • 45
  • 0

problem with crystal reports and web.config

Nov 8 2010 7:56 AM
hi all,

I have created one crystal report in Crystal Report XI using stored procedure

My stored procedure has four parameters:
1.@intFilterType
2.@strIDs
3.@dtfromDate
4.@dtToDate

from .aspx page I pass the value to these parameters. I want to use the same web.config connectionstring for my crystal report too. I don't want crystal reports to logon when reports run.
So, please help me.

Report.aspx page is given below.

Collapse | Copy Code
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Session["Selected"].ToString();
TextBox2.Text = Session["ReportBy"].ToString();
TextBox3.Text = Session["FromDate"].ToString();
TextBox4.Text = Session["ToDate"].ToString();
CrystalReportSource1.Report.FileName = Server.MapPath("Reports/RptExpiryListByitem.rpt");
ParameterDiscreteValue objDiscreteValue;
ParameterField objParameterField;
objDiscreteValue = new ParameterDiscreteValue();
objParameterField = new ParameterField();
objDiscreteValue.Value =TextBox1.Text;
objParameterField = CrystalReportViewer1.ParameterFieldInfo["@strIDs"];
objParameterField.CurrentValues.Add(objDiscreteValue);
CrystalReportViewer1.ParameterFieldInfo.Add(objParameterField);
objDiscreteValue.Value = TextBox2.Text;
objParameterField = CrystalReportViewer1.ParameterFieldInfo["@intFilterType"];
objParameterField.CurrentValues.Add(objDiscreteValue);
CrystalReportViewer1.ParameterFieldInfo.Add(objParameterField);
objDiscreteValue.Value = TextBox3.Text;
objParameterField = CrystalReportViewer1.ParameterFieldInfo["@dtFromDate"];
objParameterField.CurrentValues.Add(objDiscreteValue);
CrystalReportViewer1.ParameterFieldInfo.Add(objParameterField);
objDiscreteValue.Value = TextBox4.Text;
objParameterField = CrystalReportViewer1.ParameterFieldInfo["@dtToDate"];
objParameterField.CurrentValues.Add(objDiscreteValue);
CrystalReportViewer1.ParameterFieldInfo.Add(objParameterField);
CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
}

Answers (1)