0

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!!!";
        }
    }
Attachments eror.JPG 55.74 KB
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ryathegr8
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.