i have written a login code which was sucessfuly working noe i have changes i need to take the uid and password from different table of same databse i changed the query where the table name i have changed and the field name but it is not working why
- string strSelect = "SELECT COUNT(*) FROM [database name].[dbo].[tablename] WHERE ReserveUID = @Username AND LoginPassword = @Password";
-
- SqlConnection con = new SqlConnection(con_Vas);
- SqlCommand cmd = new SqlCommand();
- cmd.Connection = con;
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = strSelect;
-
- SqlParameter username = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
- username.Value = txtusername.Text.Trim().ToString();
- cmd.Parameters.Add(username);
-
- SqlParameter password = new SqlParameter("@Password", SqlDbType.NVarChar, 100);
- password.Value = Encrypt(txtpassword.Text.Trim());
- cmd.Parameters.Add(password);
-
-
- con.Open();
- int result = (Int32)cmd.ExecuteScalar();
- con.Close();
-
- if (result >= 1)
- {
-
- Response.Redirect("ProjectDashboard.aspx");
- }
- else
- {
- txtusername.Text = "";
- txtpassword.Text = "";
- Label1.Text = "invalid credential";
- }