try { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.LENOVO-74FE9906\Desktop\Orignal Project Part 1\Inventory Management System\IMS.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); string query = "SELECT [user].* FROM [user] where u_name='" + txtusername.Text + "' and pwd='" + txtpassword.Text + "'"; SqlCommand com = new SqlCommand(query, con); con.Open(); if (txtusername.Text == "admin") { if (com.ExecuteReader().HasRows) { Response.Redirect("index.html"); Label3.Text = "successfully"; } else { Label3.Text = "not successfully"; txtusername.Text = ""; txtpassword.Text = ""; } } else if (txtusername.Text == "user") { if (com.ExecuteReader().HasRows) { Response.Redirect("userinventory.aspx"); Label3.Text = "successfully"; } else { Label3.Text = "not successfully"; txtusername.Text = ""; txtpassword.Text = ""; } } con.Close(); } catch (Exception ex) { Console.Write("" + ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)