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";
- }


Puneet KankarRank #446 · 5.6K reputationPosted Feb 17, 2019, 11:56 PM EST
Piyush PansuriyaRank #454 · 5.5K reputationPosted Feb 18, 2019, 1:15 AM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 4:08 AM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 6:08 PM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 6:36 PM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 6:55 PM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 7:10 PM EST
Salman BegRank #284 · 8.8K reputationPosted Feb 18, 2019, 7:37 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 12:10 AM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 5:55 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 5:56 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 6:32 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 6:41 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 6:58 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 7:31 PM EST
Subin ThomasRank #724 · 3.2K reputationPosted Feb 18, 2019, 7:42 PM EST