#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;
}
|
#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();
|
//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
|
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;
}
|
|
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. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
|

Subscribe by RSS
Subscribe by Email
132 comments :
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
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
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