I have created one inventry application.In that i have created login form.But in login form i want to login locationwise that mumbai,pune,banglore etc....means mumbai person have diffent login ,pune person have different login....Please suggest code for this...It is on high priority....
ThanksDiv

Khargesh RajputRank #616 · 3.9K reputationPosted May 14, 2015, 3:13 AM EDT
and at the login time you have to check
loginanme from textbox
password from textbox
location from dropdownlist
select * from table where username="loginname" and password="pwd" and location="location"
here you may pass location directly or use another table for location and from login table you can select locationid with reference to location table
also refer below tutorial
here add location field according to your choice
http://www.msdotnet.co.in/2013/04/how-to-make-registration-and-login-form.html#.VVSFnJOO7cc
Dipankar BiswasRank #992 · 2K reputationPosted May 14, 2015, 3:22 AM EDT
try it..
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select * from employee where username=@username and password=@password", con);
cmd.Parameters.AddWithValue("@username", TextBox1.Text);
cmd.Parameters.AddWithValue("@password", TextBox2.Text);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
string type = (dt.Rows[0]["type"]).ToString().Trim() ;
// store your type row cell value in variable to check condition
if (type =="Manager")
{
Session["USERID"] = TextBox1.Text;
Response.Redirect("Manager.aspx");
}
else if (type =="Salesperson")
{
Session["USERID"] = TextBox1.Text;
Response.Redirect("Salesperson.aspx");
}
else if (type =="SoftwareEngineer")
{
Session["USERID"] = TextBox1.Text;
Response.Redirect("Engineer.aspx");
}
else
{
Response.Write("Not Exists");
}
}
else
{
ClientScript.RegisterStartupScript(Page.GetType(),
"validation", "");
}
see details....http://www.c-sharpcorner.com/Blogs/14469/
Munesh SharmaRank #174 · 13.9K reputationPosted May 14, 2015, 3:42 AM EDT
here location you can give in Dropdown also,
And at the time of Login you can check with location
Amol Sonavane66 reputationPosted May 14, 2015, 3:44 AM EDT
Amol Sonavane66 reputationPosted May 14, 2015, 3:47 AM EDT