You must Sign In to post a response.
  • Category: ASP.NET

    How to pass values from data access layer(dal) to business layer(bal) in 3 tier architecture ?

    I am writing 3 tier code in c# ado.net in asp.net

    In DAL i am fetching sql table values in dataset

    Now, i want to pass that dataset from DAL to BAL and BAL to presentation layer

    Is it ok to pass whole dataset (?) taking into consideration the application's performance with regards to overall network bandwidth usgae

    If whole dataset passing is not advisable then which is the best alternative way to pass data from dal to bal ?
  • #769165
    Hai Jayesh,
    It is easy to pass the data from one layer to another layer. You just need the reference of the data access layer to your business layer and then you can create object of the class and use the method to pass the data .
    You can go through the below link where I have provided the implementation of such scenario:

    http://pawantechit.blogspot.my/2011/09/3-tier-architecture.html

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #769167
    Hi,

    You can easily pass dataset data from DAL to BAL by adding referenced assemblies.

    Your DAL should be like below

    public class DataLayer
    {

    public DataSet Get_Data(string SqlStmt)
    {
    SqlConnection con = new SqlConnection(your connection string);
    DataSet ds = new DataSet();
    SqlDataAdapter da = new SqlDataAdapter(SqlStmt, con);
    da.Fill(ds);
    return ds;
    }
    }


    and in BAL add the reference of DAL dll and call the above mentioned method like below

    public class BLayer
    {

    public DataSet Get_Data()
    {
    DataLayer dl = new DataLayer();
    return dl.Get_Data("select EmpNo,Ename,Job,Mgr,Sal,Comm from Emp");
    }
    }


    Refer below link this might be helpful to you...
    http://www.dotnetspider.com/resources/45057-Working-with-3Tier-Application-with-Examples.aspx

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


  • Sign In to post your comments