locked
How to pass ASP.NET Form values to Crystal Report for ready printable format..? RRS feed

  • Question

  • User-1024101449 posted

    Hi,

    I want to pass all the ASP.NET Form control values into crystal Report.

    when i click the "Print" button, the report should open in a printable format..?

    How to do this...>

    Sunday, September 25, 2011 8:40 AM

Answers

  • User-102500655 posted

    you can pass parameters like this

    try{
                    string reportpath = Server.MapPath("TransactionReport.rpt");
                    rpt.Load(reportpath);
    
    
                    ConnectionInfo connectionInfo = new ConnectionInfo();
    
                    SqlConnectionStringBuilder conStr = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["DBConnString"].ConnectionString);
                    rpt.SetDatabaseLogon(conStr.UserID, conStr.Password, conStr.DataSource, conStr.InitialCatalog, false);
                    rpt.DataSourceConnections[0].SetConnection(conStr.DataSource, conStr.InitialCatalog, false);
                    rpt.DataSourceConnections[0].SetLogon(conStr.UserID, conStr.Password);
                    int emp_id = Convert.ToInt16(Session["Employee_ID"].ToString());
                    rpt.SetParameterValue("@AppEmployeeID", Convert.ToInt16(Session["Employee_ID"].ToString()));
                    DateTime myDateTime = DateTime.Now;
    
                    int month = Convert.ToInt16(myDateTime.Month.ToString());
                    rpt.SetParameterValue("@month", month);
                    CrvTransaction.ReportSource = rpt;
                    string monthname = ddlMonth.SelectedItem.Text.ToString();
                    divDetails.Visible = true;
                    lblMonth.Visible = true;
                    string name = ddlMonth.SelectedItem.ToString();
                    lblMonth.Text = monthname.ToString();
    }catch(Exception ex)
    { throw ex;}

    and following links will be helpfull

    http://www.velocityreviews.com/forums/t384353-print-crystal-report-in-asp-net.html

    http://www.codeproject.com/KB/aspnet/crCode.aspx


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 26, 2011 5:59 AM