0

hi

this is my code for forget password module..... i dont know why its not working....:(( i have attached the snapshot as well.... plz help me....

error is while updating.....

string strCon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

        SqlConnection objcon = new SqlConnection(strCon);
        objcon.Open();

        string str1 = "'"+txt_EmpFP_Uname.Text+"'";
        string str2 = "'" + txt_EmpFP_OldPass.Text + "'";
        String query = "Select * from EmpReg where UName="+ str1+ " and Pass =" + str2;
      
    
        SqlDataAdapter adp = new SqlDataAdapter(query, objcon);
        DataSet ds = new DataSet();
        adp.Fill(ds, "EmpReg");
        if (ds.Tables[0].Rows.Count > 0) {

              
            SqlCommandBuilder builder = new SqlCommandBuilder(adp);
            adp.UpdateCommand = builder.GetUpdateCommand();     // error occure here:((
            ds.Tables[0].Rows[0]["Pass"] = txt_EmpFP_NPass.Text;

            adp.Update(ds.Tables[0]);
            objcon.Close();
            Response.Redirect("EmpLogin.aspx");
        }
        else
        {
            lbl_EmpForPass.Text = "Employee doesnot exist!!!";
        }
    }

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.