Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i create database for the passwords and user names with sessions to distinguish between the ordinary user and the administrator.
Posted

Make a column in User table name Role and assign each type of user a different role for eg 1 for admin 2 for normal user

then at the time of login check for the value of role,if it is 1 then make admin session and redirect to admin section

otherwise redirect to normal user
 
Share this answer
 
create 2 coloumns Username Password in DB.
Two labels n 2 textbocxes in Windows form..
Button insert
double click on button...
same insertion code..

button click
{
cmd = new SqlCommand("insert into ShiftMaster values('" + cboxGroupName.Text + "','" + txtShiftCode.Text + "', con);//two textboxes her...
con.open();
cmd.executeNonQuery();
con.close();
Messagebox.show("Inserted");
}
 
Share this answer
 
Dear fellow,

It is always better if you provide full information that which technology and project you are working on. Like If you are using Asp .Net, you can also use asp.net role management as well.
Take a look.

http://msdn.microsoft.com/en-us/library/ff647401.aspx[^]

Good Luck!
 
Share this answer
 
Comments
sravani.v 27-Sep-11 6:13am    
See the question.There
already mentioned "C#"
its simple dude...

you have to create a stored procedure which retuns userid on passing username & password.

For example.ul.Check_Admin_Login(); is a function which authenticate login process and redirect the response.

C#
ul.pwd = txt_pwd.Text;
      int chk = ul.Check_Admin_Login();
          userInfo_class.unm = txt_unm.Text.Trim().ToString();
          ul.pwd = txt_pwd.Text.Trim().ToString();
          userInfo_class.unm = Convert.ToString(ul.Chk_Login());
          Session.Add("uid", userInfo_class.unm);
          if (userInfo_class.unm != "0")
          {
              Response.Redirect("Welcome.aspx");

          }
          else
          {
              lbl_message.Text = "Invalid User.";
              txt_unm.Text = "";
          }
      }
 
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