hi

i have coded for forget password module but getting an error that is attached with... dont know why its hapen....here is code

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

Add/set primary key/unique key column in EmpReg table.

ok....:) it worked to0o:)

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.