Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi ,
I have to generate the Bill and show each record on each page. I had already created xsd to take the column on report... but i able to show only the last record on the report..

So can anybody suggest me what to do ??? to show all reord on one by one page

This my code below :
C#
protected void Page_Load(object sender, EventArgs e)
    {
        SC_ID = int.Parse((Session["Soc_ID"]).ToString());
        SiteMaster obj = (SiteMaster)Page.Master;
        obj.displaySoc(SC_ID);

        DataSet ds = new DataSet();
       
        ArrayList lstFlat = (ArrayList)Session["FlatNo"];
        ArrayList stall = (ArrayList)Session["Bill_Id"];
        ArrayList ndFlatid = (ArrayList)Session["Flat_Id"];
    

        foreach (int billid in stall)
        {


            foreach (string strFlat in lstFlat)
            {
               

                foreach (int idFlat in ndFlatid)
                {
                    htdata.Clear();
                    dtconn.strConnectionString = strconnection;
                    htdata.Add("@Bill_Id", billid.ToString());
                    htdata.Add("@Flat_No", strFlat);
                    htdata.Add("@SC_ID", SC_ID);
                    htdata.Add("@Flat_Id", idFlat);


                    ds = dtconn.GetDataSetForPrc("sp_all_bill_print", htdata)

	`	   try
                    {
                        SqlConnection con = new SqlConnection(strconnection);
                        con.Open();
                        SqlCommand cmd = new SqlCommand("sp_all_bill_print", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add(new SqlParameter("@SC_ID", SC_ID));
                        cmd.Parameters.Add(newSqlParameter("@Flat_No",strFlat.ToString()));
 cmd.Parameters.Add(new SqlParameter("@Bill_Id", billid.ToString()));
cmd.Parameters.Add(new SqlParameter("@Flat_Id", idFlat.ToString()));
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        da.Fill(ds);
                    }
                    catch (Exception ex)
                    {

                    }                   
                }           
            }
        }
               
                try
                {
     string strReportPath = Server.MapPath("~//reports//") + "BILLNEW.rpt";
                    ReportDocument cr = new ReportDocument();
                    cr.Load(strReportPath);
                    cr.SetDataSource(ds);
                    CrystalReportViewer1.ReportSource = cr;
                    CrystalReportViewer1.RefreshReport();
                }
                catch (Exception ee)
                {
                }
    }
}
Posted
Updated 10-Sep-12 19:10pm
v2

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