generatign report using object data source and .rdlc file

  • I want to add an object data source for an RDL. And i want to get all the methods available which can return the data (objects) on the website datasource window. I cant see any of them in the window.

    I added an .RDLC file to my website. I am passing the parametres from .aspx to get the data set of type LIST<>.

    ITS IN UI:

    ---------

    protected void btnViewRpt_Click(object sender, EventArgs e)

    {

    WebServiceBase objWebServiceBase = new WebServiceBase();

    try

    {

    List ();

    m_Top25AncillaryProducts = objWebServiceBase.Get_Top25AncillaryProducts(Convert.ToDateTime(txtStDate.Text), Convert.ToDateTime(txtEndDate.Text), "SK");

    }

    catch (Exception ex)

    {

    throw ex;

    }

    }

    ITS IN DATA ACCESS LAYER:

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

    public List Get_Top25AncillaryProducts(DateTime stDate, DateTime edDate, string shortCut)

    {

    SqlDataReader reader;

    SqlCommand cmdToExecute = new SqlCommand();

    cmdToExecute.CommandText = "dbo.[RPT_Top25AncillaryProducts]";

    cmdToExecute.CommandType = CommandType.StoredProcedure;

    SqlDataAdapter adapter = new SqlDataAdapter(cmdToExecute);

    cmdToExecute.Connection = mainConnection;

    List ();

    DataSet ds_Top25AncillaryProd = new DataSet();

    try

    {

    cmdToExecute.Parameters.Add(new SqlParameter("@start_date", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, stDate));

    cmdToExecute.Parameters.Add(new SqlParameter("@end_date", SqlDbType.DateTime, 8, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, edDate));

    cmdToExecute.Parameters.Add(new SqlParameter("@short_cut",SqlDbType.Char, 2, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, shortCut));

    mainConnection.Open();

    reader = cmdToExecute.ExecuteReader();

    while (reader.Read())

    {

    Top25AncillaryProducts top25AncillaryProd = new Top25AncillaryProducts();

    decimal savingVal = decimal.Parse(reader["stformula"].ToString()) - decimal.Parse(reader["MSCPrice"].ToString());

    top25AncillaryProd.MSC_Price = decimal.Parse(reader["mscprice"].ToString());

    top25AncillaryProd.ProdCode = reader["msc_code"].ToString();

    top25AncillaryProd.ProdDesc = reader["descript"].ToString();

    top25AncillaryProd.Savings = savingVal;

    top25AncillaryProd.Percent = (savingVal / decimal.Parse(reader["stformula"].ToString())) * 100;

    top25AncillaryProd.UC_Price = decimal.Parse(reader["stformula"].ToString());

    m_Top25AncillaryProd.Add(top25AncillaryProd);

    }

    return m_Top25AncillaryProd;

    }

    catch (Exception ex)

    {

    throw new Exception("Audit_LogsDB::SelectAll::Error occured.", ex);

    }

    finally

    {

    mainConnection.Close();

    cmdToExecute.Dispose();

    adapter.Dispose();

    }

    }

    I have COMMON CLASS holding the properties of the list item:

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

    using System;

    using System.Collections.Generic;

    using System.Text;

    namespace Oasis.Libraries.Common

    {

    [Serializable]

    public class Top25AncillaryProducts

    {

    private string prodcode = string.Empty;

    private string proddesc = string.Empty;

    private decimal uc_price;

    private decimal msc_price;

    private decimal savings;

    private decimal percent;

    public Top25AncillaryProducts()

    {

    prodcode = string.Empty;

    proddesc = string.Empty;

    uc_price = 0.0m;

    msc_price = 0.0m;

    savings = 0.0m;

    percent = 0.0m;

    }

    public string ProdCode

    {

    get

    {

    return prodcode;

    }

    set

    {

    prodcode = value;

    }

    }

    public string ProdDesc

    {

    get

    {

    return proddesc;

    }

    set

    {

    proddesc = value;

    }

    }

    public decimal UC_Price

    {

    get

    {

    return uc_price;

    }

    set

    {

    uc_price = value;

    }

    }

    public decimal MSC_Price

    {

    get

    {

    return msc_price;

    }

    set

    {

    msc_price = value;

    }

    }

    public decimal Savings

    {

    get

    {

    return savings;

    }

    set

    {

    savings = value;

    }

    }

    public decimal Percent

    {

    get

    {

    return percent;

    }

    set

    {

    percent = value;

    }

    }

    }

    }

    I want to get the objects in the website datasource window. What are the changes and the code required for populating the RDLC report on a viewer.

    Any help would be greatly appreciated.

    Thanks,

    Suman

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply