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

You need to define the primary-key in your table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.