Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
any one pls help me out how to write code for login page in three tier architecture

i took folders like 1> Utilities : database connections and extra......
2> datacontainer: in this i declare parameters and set get properties like below

private int _loginid;
private string _username;
private String _password;

public int loginid
{
get{return _loginid;}
set {_loginid =Value;}
}

as usual username and password i wrote

3> coming to datalayer i declared object of datacontainer and i write code like below in datalayer

private void NacreLogin(DataContainer objdc, string CmdText)
{
util.Open();
SqlCommand Cmd = new SqlCommand();
Cmd.Parameters.Clear();
Cmd.Connection = util.SqlCon;/*here iam getting SqlCon not accessble due to security level*/
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = CmdText;
Cmd.Parameters.Add("@loginid", SqlDbType.Int).Value = objdc.loginid;
Cmd.Parameters.Add("@username", SqlDbType.VarChar).Value = objdc.username;
Cmd.Parameters.Add("@password", SqlDbType.VarChar).Value = objdc.password;
}
My doubts are
how to write code in buisness logic.
when i design and code login.aspx . and enter the values in username,password and loginid for login.what is the process in business logic
how entered values will be compared to database sp_tbl_login storedprocedure values.

Thanks In Advance
Posted
Updated 11-Jul-11 23:30pm
v4

1 solution

Honestly. Fix your code. The process is obvious. Pass in the username and password and get back if it's valid. It's always concerning when people know lots of buzzwords (like 3 tier), but don't know how to code the most trivial task. You can't access the object b/c there's an issue in your design. We don't know what that is, based on the 1/2 an error message you posted, and no access to the SqlCon property. Your data layer should contain the connection, however. Where else would it live ?

Why would a login method accept the name of the proc to call ? That seems retarded to me. you'll have many different login procs that share this method ?
 
Share this answer
 

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