Introduction
Here I will explain about uses of 3-Tier architecture and how to create or implement 3-tier architecture for our project in asp.net
Description
1. What is the use of 3-tier architecture and why we go for that architecture?
2. First we need to know what 3-Tier architecture is.
3. How to create 3-Tier architecture for our project?
Uses of 3-Tier Architecture
1. To make application more understandable.
2. Easy to maintain, easy to modify application and we can maintain good look of architecture.
3. If we use this 3-Tier application we can maintain our application in consistency manner.
Basically 3-Tier architecture contains 3 layers
1. Application Layer or Presentation Layer
2. Business Access Layer(BAL) or Business Logic Layer(BLL)
3. Data Access Layer(DAL)
Here I will explain each layer with simple example that is User Registration
Application Layer or Presentation Layer
Presentation layer contains UI part of our application i.e., our aspx pages or input is taken from the user. This layer mainly used for design purpose and get or set the data back and forth. Here I have designed my registration aspx page like this
This is Presentation Layer for our project Design your page like this and double click on button save now in code behind we need to write statements to insert data into database this entire process related to Business Logic Layer and Data Access Layer.
Now we will discuss about Business Access Layer or Business Logic Layer
Business Access Layer (BAL) or Business Logic Layer (BLL)
This layer contains our business logic, calculations related with the data like insert data, retrieve data and validating the data. This acts as a interface between Application layer and Data Access Layer
Now I will explain this business logic layer with my sample
I have already finished form design (Application Layer) now I need to insert user details into database if user click on button save. Here user entering details regarding Username, password, Firstname, Lastname, Email, phone no, Location. I need to insert all these 7 parameters to database. Here we are placing all of our database actions into data access layer (DAL) in this case we need to pass all these 7 parameters to data access layers.
In this situation we will write one function and we will pass these 7 parameters to function like this
String Username= InserDetails (string Username, string Password, string Email, string Firstname, string Lastname, string phnno, string Location)
If we need this functionality in another button click there also we need to declare the parameters like string Username, string Password like this rite. If we place all these parameters into one place and use these parameters to pass values from application layer to data access layer by using single object to whenever we require how much coding will reduce think about it for this reason we will create entity layer or property layer this layer comes under sub of group of our Business Logic layer
Don't get confuse just follow my instructions enough
How we have to create entity layer it is very simple
Right click on your project web application---> select add new item ----> select class file in wizard ---> give name as BEL.CS because here I am using this name click ok
Open the BEL.CS class file declare the parameters like this in entity layer
Don’t worry about code it’s very simple for looking it’s very big nothing is there just parameters declaration that’s all check I have declared whatever the parameters I need to pass to data access layer I have declared those parameters only
BEL.CS
#region Variables
/// <summary>
/// User Registration Variables
/// </summary>
private string _UserName;
private string _Password;
private string _FirstName;
private string _LastName;
private string _Email;
private string _Phoneno;
private string _Location;
private string _Created_By;
#endregion
/// <summary>
/// Gets or sets the <b>_UserName</b> attribute value.
/// </summary>
/// <value>The <b>_UserName</b> attribute value.</value>
public string UserName
{
get
{
return _UserName;
}
set
{
_UserName = value;
}
}
/// <summary>
/// Gets or sets the <b>_Password</b> attribute value.
/// </summary>
/// <value>The <b>_Password</b> attribute value.</value>
public string Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
/// <summary>
/// Gets or sets the <b>_FirstName</b> attribute value.
/// </summary>
/// <value>The <b>_FirstName</b> attribute value.</value>
public string FirstName
{
get
{
return _FirstName;
}
set
{
_FirstName = value;
}
}
/// <summary>
/// Gets or sets the <b>_LastName</b> attribute value.
/// </summary>
/// <value>The <b>_LastName</b> attribute value.</value>
public string LastName
{
get
{
return _LastName;
}
set
{
_LastName = value;
}
}
/// <summary>
/// Gets or sets the <b>_Email</b> attribute value.
/// </summary>
/// <value>The <b>_Email</b> attribute value.</value>
public string Email
{
get
{
return _Email;
}
set
{
_Email = value;
}
}
/// <summary>
/// Gets or sets the <b>_Phoneno</b> attribute value.
/// </summary>
/// <value>The <b>_Phoneno</b> attribute value.</value>
public string Phoneno
{
get
{
return _Phoneno;
}
set
{
_Phoneno = value;
}
}
/// <summary>
/// Gets or sets the <b>_Location</b> attribute value.
/// </summary>
/// <value>The <b>_Location</b> attribute value.</value>
public string Location
{
get
{
return _Location;
}
set
{
_Location = value;
}
}
/// <summary>
/// Gets or sets the <b>_Created_By</b> attribute value.
/// </summary>
/// <value>The <b>_Created_By</b> attribute value.</value>
public string Created_By
{
get
{
return _Created_By;
}
set
{
_Created_By = value;
}
|
Our parameters declaration is finished now I need to create Business logic layer how I have create it follow same process for add one class file now give name called BLL.CS. Here one point don’t forget this layer will act as only mediator between application layer and data access layer based on this assume what this layer contains. Now I am writing the following BLL.CS(Business Logic layer)
#region Insert UserInformationDetails
/// <summary>
/// Insert UserDetails
/// </summary>
/// <param name="objUserBEL"></param>
/// <returns></returns>
public string InsertUserDetails(BEL objUserDetails)
{
DAL objUserDAL = new DAL();
try
{
return objUserDAL.InsertUserInformation(objUserDetails);
}
catch (Exception ex)
{
throw ex;
}
finally
{
objUserDAL = null;
}
}
#endregion
Here if you observe above code you will get doubt regarding these
what is
BEL objUserDetails
DAL objUserDAL = new DAL();
|
and how this method comes
return objUserDAL.InsertUserInformation(objUserDetails);
Here BEL objUserDetails means we already created one class file called BEL.CS with some parameters have you got it now I am passing all these parameters to Data access Layer by simply create one object for our BEL class file
What is about these statements I will explain about it in data access layer
DAL objUserDAL = new DAL();
return objUserDAL.InsertUserInformation(objUserDetails);
this DAL related our Data access layer. Check below information to know about that function and Data access layer
Data Access Layer(DAL)
Data Access Layer contains methods to connect with database and to perform insert,update,delete,get data from database based on our input data
I think it’s to much data now directly I will enter into DAL
Create one more class file like same as above process and give name as DAL.CS
Write the following code in DAL class file
//SQL Connection string
string ConnectionString = ConfigurationManager.AppSettings["LocalConnection"].ToString();
#region Insert User Details
/// <summary>
/// Insert Job Details
/// </summary>
/// <param name="objBELJobs"></param>
/// <returns></returns>
public string InsertUserInformation(BEL objBELUserDetails)
{
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("sp_userinformation", con);
cmd.CommandType = CommandType.StoredProcedure;
try
{
cmd.Parameters.AddWithValue("@UserName",objBELUserDetails.UserName);
cmd.Parameters.AddWithValue("@Password", objBELUserDetails.Password);
cmd.Parameters.AddWithValue("@FirstName", objBELUserDetails.FirstName);
cmd.Parameters.AddWithValue("@LastName", objBELUserDetails.LastName);
cmd.Parameters.AddWithValue("@Email", objBELUserDetails.Email);
cmd.Parameters.AddWithValue("@PhoneNo", objBELUserDetails.Phoneno);
cmd.Parameters.AddWithValue("@Location", objBELUserDetails.Location);
cmd.Parameters.AddWithValue("@Created_By", objBELUserDetails.Created_By);
cmd.Parameters.Add("@ERROR", SqlDbType.Char, 500);
cmd.Parameters["@ERROR"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
string strMessage = (string) cmd.Parameters["@ERROR"].Value;
con.Close();
return strMessage;
}
catch (Exception ex)
{
throw ex;
}
finally
{
cmd.Dispose();
con.Close();
con.Dispose();
}
}
#endregion
|
Here if you observe above functionality I am getting all the parameters by simply creating BEL objBELUserDetails. If we create one entity file we can access all parameters through out our project by simply creation of one object for that entity class based on this we can reduce redundancy of code and increase re usability
Observe above code have u seen this function before? in BLL.CS i said i will explain it later got it in DAL.CS I have created one function InsertUserInformation and using this one in BLL.CS by simply creating one object of DAL in BLL.CS.
Here you will get one doubt that is why BLL.CS we can use this DAL.CS directly into our code behind we already discuss Business logic layer provide interface between DAL and Application layer by using this we can maintain consistency to our application.
Now our Business Logic Layer is ready and our Data access layer is ready now how we can use this in our application layer write following code in your save button click like this
protected void btnsubmit_Click(object sender, EventArgs e)
{
string Output = string.Empty;
if (txtpwd.Text == txtcnmpwd.Text)
{
BEL objUserBEL = new BEL();
objUserBEL.UserName = txtuser.Text;
objUserBEL.Password = txtpwd.Text;
objUserBEL.FirstName = txtfname.Text;
objUserBEL.LastName = txtlname.Text;
objUserBEL.Email = txtEmail.Text;
objUserBEL.Phoneno = txtphone.Text;
objUserBEL.Location = txtlocation.Text;
objUserBEL.Created_By = txtuser.Text;
BLL objUserBLL = new BLL();
Output = objUserBLL.InsertUserDetails(objUserBEL);
}
else
{
Page.RegisterStartupScript("UserMsg", "<Script language='javascript'>alert('" + "Password mismatch" + "');</script>");
}
lblErrorMsg.Text = Output;
}
|
Here if you observe I am passing all parameters using this BEL(Entity Layer) and we are calling the method InsertUserDetails by using this BLL(Business Logic Layer)
Now run your applciation test with debugger you can get idea clearly.
I hope it helps you.
Download sample code attached
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
226 comments :
«Oldest ‹Older 1 – 200 of 226 Newer› Newest»Your All Coding in Blogspot is meaningfull.Nice tutorial of 3-tiers for beginner.. I Rate 5 Star
thanks hyu keep visiting......
I am really impressed the way you make me understand.Thank you very much.Keep on bloging..
thanks jooey
very nice
wheres d database?
Hi, really great tutorial here. Before reading this I had some problems understanding when to use an entity layer or property layer. I noticed some tutorial used it, and some didnt. I believe you explained that part very clear here.
nice wesite suresh.
hi suresh tis site is very useful for me and all dotnet developers.thank u.
HIIII WHAT AN IDEA SR GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
Hi suresh, very nice website and this topic is really very usefull..
While visiting this site I'm getting interest towards subject.I feel thankful to you for that
Hai sir this rajesh from kakinada,iam working as .net developer ,Today i see the blog i am really impressed,this site is very usefull me.
Sir this is mail id:vuda.rajesh59@gmail.com please send your mail id.
nice article very useful
Thank you very much Mr. Suresh
thanku ...
Hello Sir,
Thanks ... It is very helpful for all ...Keep up your Good work. I am very impressed the way you are explaining.
Hi Suresh,
Can you give one simple project for MVC3 application in Visual Studio 2010
where is database procedure...
thanks for your valuable information, it make ma to easy understand 3 tier architech. keep on rocks
What is need of private variables in BEL.cs as you are using public variables everywhere in your example?
Awesome..i was searching for such a good poast. thanks alot :)
really nice article!
Sir, how to create database for this project? i m new in this field so please explain for creating database and how to connect.
Hi! Brothers, please tell me how to create database for this project.
Its really easy way to understand 3-tire Arch.
I have already done but confused abt 3-tire.
Thanks Suresh...
Hello suresh p-lease save me...i have lots of confusion when i writting SP for this article...i am requested to you...please tell me key points to create proc for this app..thanks
Hi Suresh, While launching the applicaton, after entering the user details its giving me an error "Procedure or function sp_userinformation has too many arguments specified."
Hi Suresh, While launching the applicaton, after entering the user details its giving me an error "Procedure or function sp_userinformation has too many arguments specified."
Hello Anonymous for fixing that Bug we need to pass prameter for otput...here is the Proc for that app...after writing the code once test in sqlserver only then after write sp in DAL class..
CREATE TABLE tbl_tier
(
UserName VARCHAR(30),
Password VARCHAR(30),
FirstName VARCHAR(30),
LastName VARCHAR(30),
Email VARCHAR(30),
Phoneno VARCHAR(30),
Location VARCHAR(30),
Created_By VARCHAR(30)
)
ALTER PROC sp_userinformation
(
@UserName VARCHAR(30),
@Password VARCHAR(30),
@FirstName VARCHAR(30),
@LastName VARCHAR(30),
@Email VARCHAR(30),
@Phoneno VARCHAR(30),
@Location VARCHAR(30),
@Created_By VARCHAR(30),
@ERROR VARCHAR(30) OUTPUT
)
AS
BEGIN
INSERT INTO tbl_tier VALUES(@UserName,@Password,@FirstName,@LastName,@Email,@Phoneno,@Location,@Created_By)
END
DECLARE @HN VARCHAR(30)
EXEC sp_userinformation 'SHANKAR','12345','SHANKAR','PARSHIMONI','PARSHI@GMAIL.COM','9966385883','HYDERABAD','SHANKAR', @ERROR=@HN OUTPUT
SELECT @HN
hello suresh pls visit this site,i am getting one bug in BLL.cs file i,e Unable to cast object of type 'System.DBNull' to type 'System.String'...i have been fixing this bug but i coudn't do...so please drop you answer ...tanq
Hello friends finally i got final result in 3 tier architectur app.but i have taken only 3 controls.i have posted entire code including proc in my blogspot...so please click this link for further details http://www.shankar-mydotnetsite.blogspot.in/
Hi this post was very nice & 200% useful for 3Tier freshers including me. This shows your technical stuff as well as reputation.
Iam expecting similar like this post for basic or freshers who are willing to learn mvc, because we & our blog fans need to update with current trend & technology.
So, Please post mvc example.
Thank you!
Hi this post was very nice & 200% useful for 3Tier freshers including me. This shows your technical stuff as well as reputation.
Iam expecting similar like this post for basic or freshers who are willing to learn mvc, because we & our blog fans need to update with current trend & technology.
So, Please post mvc example.
Thank you!
nice web site.... keep it up
NOTICE
BEL works just for calling method of DLL(realy overhead of coding and need one extra class).
why can't we write(call dll method)in codebihind file(directly in button "Click event")?
@Shankar - Kindly add the below line after the insert statement
SET @ERROR ='success' to avoid casting error.
For a fresher like me it will be very helpful if you publish the entire code (ie), with stored procedures and database tables.
CREATE TABLE tbl_tier
(
UserName VARCHAR(30),
Password VARCHAR(30),
FirstName VARCHAR(30),
LastName VARCHAR(30),
Email VARCHAR(30),
Phoneno VARCHAR(30),
Location VARCHAR(30),
Created_By VARCHAR(30)
)
ALTER PROC sp_userinformation
(
@UserName VARCHAR(30),
@Password VARCHAR(30),
@FirstName VARCHAR(30),
@LastName VARCHAR(30),
@Email VARCHAR(30),
@Phoneno VARCHAR(30),
@Location VARCHAR(30),
@Created_By VARCHAR(30),
@ERROR VARCHAR(30) OUTPUT
)
AS
BEGIN
INSERT INTO tbl_tier VALUES(@UserName,@Password,@FirstName,@LastName,@Email,@Phoneno,@Location,@Created_By)
SET @ERROR='Success'
END
the stored procedure should look like above. You need to pass the out parameter.
do i have to create a class for each table?
i mean BEL class.
Hey..dats a very easiest way you explained..
really helpfull..
Very good artical sir ........
Awesome post..I got idea about the 3 tier architecture...thank u so much sir.
I am going to develop a website----Online Examination System in asp.net with 3 tier architecture. Plz help me how can I do it as I new in asp.net, plz explain me in detail..
Thanking u.
No need to add entity layer.....
BAL and DAL are enough...
where is the code for reset button?
it is just to clear all the fields.........
Vry nice description of 3 tier architecture for begginer.. Thank u!!
GUD POST
gr8
hi! suresh
it'S very helpful
but, please write the stored procdure of it.
that'S awesome
thank you sir
good information thank you
fabulous article . Got a clear picture regarding entity/property layer.
Regards
Raj
Niccceeeee bro.... easiest and best one from all
realy a nice tutorial i ever seen about three tier architecture........
its very nice sir to understand easily i am thankful to u for that
haii... this post is very helpful... i want to learn more and i have some doubts.. pls give me your mailid
Hi, I like your example of three tier example .It is very easy to understand .
I have a request for you can you please tell me about stored Procedure ,So i can get best explanation.
THANKS A LOT..And keep it up
HAI
in .aspx it show error at InsertUserDetails(objUserBEL);
shos that 'BEL does not contain a definition for 'InsertUserDetails'and no extension method 'InsertUserDetails' accepting a first argument of type 'BEL' could be found
what is problem in this
suresh bhayya awesome simply code bhayya
Exactly good working by you guys....
keep it continues
Thanks to understand 3 tier arch...
very nice Mr Suresh...
i like ur demo and code too..
Mr Harshu..pls check parameter which u passed...
so u can solve ur error...
Very good article I understood it given step by step...very useful
only the thing is can u provide this article without using out parameter it is difficult to understand fresher how the value is returned? to the BLL can you brief it?
Thank in advance..
Thank u sir.....:)
Nice article .Will you pls explain how to make 3-tier architecture?
can u please upload image to folder using this same method.... please
gud one...
nice..
hi Mr.suresh...........
Its very helpful to me and i have a doubt?
how can i insert the values in more than tables from windows form to database via DAL and BAL concept...Please Tell me and i am waiting for your ans
thank u for sharing the articles.....
Very clear for freshers........
Very clear for freshers........
Hi suresh its a perfect 3 tier architecture code and very easy to understand. please mention connection string in web.config file.
please send me how to update dropdownlist inside gridview inn rowupdating event includind database back up. My mail is rangarao58@gmail.com
Hi suresh its a perfect 3 tier architecture code and very easy to understand. please mention connection string in web.config file.
please send me how to update dropdownlist inside gridview inn rowupdating event includind database back up. My mail is rangarao58@gmail.com
Hi Suresh this is a good example for but not for 3 tier
Hi Suresh this is a good example for 3 layer but not for 3 tier
Suresh, u r really doing a nice job..
your way of explanation is really easy and efficient.. :)
Ya its good topic..
But i have one doubt on 3 tier architecture.
How to fill master and child table using 3 Tier architecture by using Transaction?
Please send me answer to this mail id frnz.jun@gmail.com
Jayant :gud 1 it actually made some thoughts clear
its very valuable for me i want mvc demo project also plz plz plz send me on e-mail sureshbehera12@gmail.com
great
Really it is a very helpful artical for beginners and I got very much help from your article in our final year project.Thanks u mr.suresh and keep updating....
hai suresh.Is it mention any connectionstring in bll.i follow u r steps.when i am trying to execute
"The connectionstring property has not been initialized" error showing in bll.
Hai Suresh, it is much useful for me..., And It is very easy to understand your presentation.
good blog sir.. easy to understand.
great job...............
good blog sir.. easy to understand.
great job...............
Thanks...It is Useful for me...great explaination
Thank U very Much.... :)
thank you sir ,this is helpful content
Nice and Very Help Full Sir
Thank you This is very helpful
u should be a great teacher..u explains in very simple manner so newer people can also get your blogs...thanks u
Clearly understood what is 3-tier atchitecture . Thank you .
i want coding for sign out in 3 tier architecture with session concept
Thanks Suresh,
It is realy helpful information for any .net developer and the way you explained is simply awesome...!!
Hi Suresh,
I must say you are great. I visit your site almost daily, and learn at least something new everyday. Keep it up.
Your All Coding in Blogspot is meaningfull.Nice tutorial of 3-tiers for beginner..
Hello Suresh.
it is really helpfull....
keep it up.....
VOUCHER:
• VOUCHER NO (PK) (VAR 30)
• DATE (VAR 10)
• PAID TO (VAR 30)
• AMOUNT (DOUBLE 30)
• REASON (VAR 45)
• AUTHORIAZED SIGNATURE (TEXT )
Voucher is the table and folling are the attribute now i want desining and store procedure with 3-tire architure with coding every thing Please help me out of the proble are mail me sunilkumar.subbu@gmail.com
Bhai.. Suresh Thoda Easy Way me 3 Tire ka Coding Nahi Hai Kya ?
Ye Samaj Me Nahi aa raha hai..
Thoda samj me aye esa kucchhh Likho na pls yaar
I m Fresher for 3 tier... to kya aap kuchh Help Kar sakte ho
nice sir its impressive and keep doing this type of stuff in easy manner.
thanks a lot
hello my query is how to implement 3 tiers Architecture in whole asp.net project i.e if there is more than 10 form so how to implement 3 tiers architecture is there create each bal,dal for each databasse code
please solve my query
Nice article .Will you pls explain how to make MVC 4 ?
nice
i got error in DAL.cs nullreference was unhandled by code in connectionstring
ERROR***
i have initialized my dal object to null in finally block,
its showing error,
ExecuteNonQuery: Connection property has not been initialized.
namespace BLclass
{
public class BLPerson
{
public string RegisterUser(PersonInfo entityObj)
{
PersonDALclass dalObj = new PersonDALclass();
try
{
return dalObj.RegisterUser(entityObj);
}
catch (Exception ex)
{
throw ex;
}
finally
{
dalObj = null;
}
}
}
whats wrong in this code.
thanks alot dear suresh for your fruitful postings.
good post really it is very useful for everyone .thanks a lot .awesome work by you
in our webpage to bind textbox we do as
textbox1.text
what is the correct synatx for binding drop down list
mail me on my id manpreettwinkle0@gmail.com
urgent
Good Job Suresh........Awesome Explanation in all your tutorials....
thanks....It's good explanation.....
nice
I cannot access BEL in in DAL class... i.e . I cannot write
BEL b=new BEL() // Here BEL is not coming in intellisence ...
So good site for us..thanks this site..
its very usefull to all
Good one,Very Useful
Hi,
DO I need to create seperate classes for each table in BEL class ?
This is one of the best site I ever seen ..
CODE FOR SAVING RADIO BUTTON (DAL,BAL & PRESENTATION LAYER)VALUE IN 3 TIER
KINDLY REPLY
Thanks alot suresh... awesome explanation..
Really a Grate Tutorials for Freshers:)
its really help full for those people who want to learn about 3-tire architectre ....thnak you very much sir....
thanks suresh.......
very usefull to me
Easy way to learn 3-tier arch for every programmer ..................keep it up suresh
Hi this post is good to understand but how to display in the gridview please help me out
Marvelous example
very useful....great work
really nice website for dotnet developer..thanks for my career
Hello Suresh,
Can you please explain, which reference is to be added to which layer.
I have added BLL reference in DLL and Application Layer. Now when am trying to add DLL reference to BLL it says A reference to DLL couldn't be added. Adding this project as a reference will cause circular dependency, and without adding DLL reference to BLL i guess we cant access the methods of DLL in BLL.
Please help.
Thanks,
Saurabh
Thank you.... its really very useful...
u are realy gr8!!!! keep it up n thnx
thanks...very useful....
namespace DAL
{
public class Employee
{
int employeeID;
string lastName; // should be (20) chars only
string firstName; // should be (10) chars only
string title; // should be (30) chars only
string address; // should be (60) chars only
string city; // should be (15) chars only
string region; // should be (15) chars only
string postalCode; // should be (10) chars only
string country; // should be (15) chars only
string extension; // should be (4) chars only
public int EmployeeID
{
get
{
return employeeID;
}
set
{
employeeID = value;
}
}
public string LastName
{
get
{
return lastName;
}
set
{
lastName = value;
}
}
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
}
}
public string Title
{
get
{
return title;
}
set
{
title = value;
}
}
public string Address
{
get
{
return address;
}
set
{
address = value;
}
}
public string City
{
get
{
return city;
}
set
{
city = value;
}
}
public string Region
{
get
{
return region;
}
set
{
region = value;
}
}
public string PostalCode
{
get
{
return postalCode;
}
set
{
postalCode = value;
}
}
public string Country
{
get
{
return country;
}
set
{
country = value;
}
}
public string Extension
{
get
{
return extension;
}
set
{
extension = value;
}
}
}
}
in this why u have used namespace DAL and how can i create in my code.
Its really very helpful
It's really very helpful. Thank you!
Hello.. Its very helpful article. But, according to my understanding, Actually 3 tier architecture means it contains Application layer, Business Layer and Data Access Layer and each layer should be in separate machines. Actually the example above illustrates N-layer architecture.. Could u please ellaborate the difference between n-tier and n-layer architecture in brief?
thanks sir ...very useful
One question..
As you are creating Object of DAL in BAL to get access of its method. Shouldn't we use dependency injection.
Also we can Inherit BLL from BEL
Please give your inputs
Really very helpfull...........
Please help me .. i don't understand this line
cmd.Parameters.Add("@Error",sqlDbType.char,500);
sqlDbType can't exist in the current context.
I also using namespace
using System.Data;
using System.Data.SqlClient;
Yet error can seen..i don't understand.
how to create a login page by giving the username and password and getting details of the registered member
Bro i understood all clearly.But my question is my web app contains more forms.so i need to connect all with DB.so Which is best method for each form one one DAL code file or one DAL code for all pages ?
Please help me,,my id : pk.suhail47@gmail.com
thanks bro........
Very nice thank u very much
Thank u...i got it. but
i need login page using same 3 tier architech..
i will say best tute...for begineers...
very nice tutorial........thanks..
hi,
i am getting error in this bll code that "object reference set to an instance of object."NUll Reference Exception.
can anyone help in this issue...
thanks in advance
both BEL and DTO is same?wer we BEL wether in busness entity or wer?,,please execute same proj using store procedure,,
ya..i wrote code in stored procedure also...but in bll.cs its shows error near finally...while executig...
Your are created a tightly coupled 3 tired architecture. If you go to your deployment situation, it will be very hesitate. It mean every layer goes to separate server... you need to create a one service layer for communicate each layer, it will be change your entire architecture and the code.
If you have any other solution, just share your knowledge.
Nice tutorial of 3-tier architecture for beginners......
which layer would JQuery fit into ? Thanks.
i also liked it....
Can u post similar thing for mvc (including MVC, MVC1,MVC2,MVC3 and MVC4)
Hai ! This is awesome tutorial for us.....Thank you very boddy
sir plz send ppt presentation ,how we can use web services in news website
sir send me ppt rameshjoshi375@gmail.com
Thanks Suresh.
Look him, he has written really comprehensive article on 3 tier architecture - http://www.dotnetfunda.com/articles/show/2708/3-tier-architecture-in-aspnet-a-complete-article
Thanks
excellent. but how to use a simple query instead of stored procedure. that is how to pass the query like select * from table do we need to create different methods for different entities? please reply soon.
i got error like sp_userinformation has too many arguments specified....what does it mean?? can u plz tell me??
one of the best sites
niranjan :may be the parameters you are passing and parameters in the stored procedure is more compaired to the other one
USE [Techproperty]
GO
/****** Object: StoredProcedure [dbo].[BuilderProc] Script Date: 01/10/2014 16:49:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[BuilderProc]
@uid int=null,
@BuildersName varchar(100)=null,
@Phone varchar(100)=null,
@EmailId varchar(100)=null,
@City varchar(100)=null,
@Address varchar(100)=null,
@id int=null
as
begin
if(@uid=0)
Insert into Dbbuilder (BuildersName,Phone,EmailId,City,Address,CreatedDate,Active)Values (@BuildersName,@Phone,@EmailId,@City,@Address,GETDATE(),1)
end
if(@uid=1)
begin Update Dbbuilder set BuildersName=@BuildersName,Phone=@Phone,EmailId=@EmailId,City=@City,Address=@Address,ModifiedDate=GETDATE() where Active=1 and id=@id
end
if(@uid=2)
begin update Dbbuilder set Active=0 where id=@id
end
if(@uid=3)
begin Select id,BuildersName,Phone,EmailId,City,Address from Dbbuilder where Active=1
end
if(@uid=4)
begin Select id,BuildersName,Phone,EmailId,City,Address from Dbbuilder where Active=1 and id=@id
end
if(@uid=5)
begin select BuildersName from Dbbuilder where Active=1
end
.....this is procedure
Please give back up of database also.
Hi,
I have a problem with web.config file
My Connection String is stored in web.config file.Which is in UI Layer.Then How can to access my web.config file from Data Acess Layer.Please tell your suggestion .Any help would be appriciated.Thanks
Really very nice for freshers...
it was really helpful very nice article to understand 3 tire best ... thank you so much for providing this article ... it really helped me alot
Thank you Suresh...Good one
very nice explanation with example....thank you
NIce one for beginners thank
Very useful for understanding.Thank you so much.
Value for time..!! Thankyou :)
simply superb
Nice articel and also we expecting more interview related question and answers from you.
Nice Article... i am really very thankful.
Hi suresh I create one website in 3 tire architecture when I publish with filesystem and upload in live it give error
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'dbo.Admin.Index'.
Source Error:
Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Index.master.cs" Inherits="dbo.Admin.Index" %>
thanks a lot...
I want to insert image using 3 layer Arch. but there is a err. saying that
Operand type clash: nvarchar is incompatible with image
wha is the reason
its very useful for beginners sir..........thank you
Thanks very much anonymous.... god bless you
hello....sorry to say this is three layer not three tier application..........
Nice tutorial....
Hi .....very gud work....very useful for beginner
Thank you........
Very useful for me ---- Thank's a lot bro
Helooooo...i want to know about the .Net for the interview perpose only..not programming totally.
Thanks for stepwise explanation....Well designed...Great Article!!!
nice article...!!
very useful........
its great for 3 layer
Now understanding what exactly 3 tier concepts..Thank You...
nice concept which is easy to understand
Hi,
Thanks for the article. Can you please confirm, is it possible to deploy these deliverable in three different servers? If that is the need, what is your recommendation?
very nice concept to understand 3 tier. if you an idea about MVC latest trend so its great for us.
very use full article
God of asp.net
Hi Sir,
i am udhaya kumar .Net Developer. i have a doubt "" How to display a image in gridview in three tier application using C#... Then How to display auto increment values in textbox in three tier application using C# """"
Please clear my doubt asap..
My Mail id:udhaya@igenuinesoft@gmail.com
Note: Only a member of this blog may post a comment.