Hi,
Try to use dataset instead of datareader.like
string str = "select * from Companies where CompanyID='" + Session["CompanyID"].ToString() + "'";
SqlCommand com = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
if(currentpassword.Text ==ds.Tables[0].Rows[0]["password"])
{
str = "update Companies set Password='" + newpassword.Text + "' where CompanyID=" + Session["CompanyID"].ToString() + "";
com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
lblError.Text = "Password changed Successfully";
}
}