locked
Crystal Report RRS feed

  • Question

  • User669521406 posted

    Please how to pass a parameter to a crystal report in visual studio 2012 please? i need to it please, i'm going to retrieve an id from query string and pass it to the crystal report to get a value, i don't want to show enter id 

    Tuesday, March 4, 2014 4:59 PM

Answers

  • User-510141866 posted

    Hi, There are lot of examples available in internet. Please visit all the site from below link

    https://www.google.co.in/#q=pass%20parameter%20to%20crystal%20report%20asp.net%20c%23

    Refer Link

    ReportDocument reportdocument = new ReportDocument();
    reportdocument.Load(Server.MapPath("CrystalReport.rpt"));
    reportdocument.SetDatabaseLogon("", "", "SureshDasari", "MySampleDB");
    reportdocument.SetParameterValue("Username", txtUserName.Text);
    CrystalReportViewer1.ReportSource = reportdocument;

     from above lines
     reportdocument.SetParameterValue("Username", txtUserName.Text);
      as per your requirement
      reportdocument.SetParameterValue("Username", Convert.ToInt32(Request.QueryString[n].toString()); //if parameter in int type
      hope it helps....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 5, 2014 12:12 AM