How can i solve my error ??
hi..when i run my loging page.. that time my usernm wrong &password fieldis right then its work my loging page.....pls give some help
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Vimal KandasamyRank #2,151 · 661 reputationPosted Mar 4, 2009, 9:10 PM EST
hi..
please tel me exactly what is your problem...
Rahul Kumar SaxenaRank #36 · 36.5K reputationPosted Mar 4, 2009, 9:27 PM EST
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Mar 5, 2009, 6:19 AM EST
Try the following code for your login control:
I have two textbox txtEmployeeID is for userName and txtPIN for password,onclick of submit button execute the following code. In my user table usr_vch_Name field is for userId and usr_vch_Password holds tha password
bool blnFound = false;
SqlConnection sqlCon = null;
Array arrOptions;
int intIndex = 0;
sqlCon = new SqlConnection(ConfigurationManager.AppSettings["con"].ToString());//fetching the connection string from web.config.
sqlCon.Open();
SqlCommand cmd = new SqlCommand("select * from Users where usr_int_Type=1 or usr_int_Type=3 ", sqlCon);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (dr["usr_vch_Name"].ToString() == txtEmployeeID.Text)
{
if (dr["usr_vch_Password"].ToString() == txtPIN.Text)
{
blnFound = true;
// SUCCESSFULLY USER VALIDATED
}
}
}
if (!blnFound)
MessageBox.Show("Wrong login info is provided");
txtEmployeeID.Text = "";
txtPIN.Text = "";
dr.Close();
sqlCon.Close();