v5rox 0 Newbie Poster

hi, i am trying to update password on click of forgot password hyperlink for login.
however wen i enter the username on the basis of which the password has to be modified by asking the security question, i get the following error:
Specified cast is not valid.
i have check from the backend and the values are coming in variables, but i dont know y it is giving this error even wen i enter the correct value.
the code is given below

protected void okBTN_Click(object sender, EventArgs e) 
    {
        string uname = usernametxt.Text; //this is the textbox in which i am entering the username and then saving it in a variable called uname
        

       Facade unameFacade = new Facade();
        Facade sqFacade = new Facade();
        try
        {
            int id = unameFacade.selectUname(uname);storing the entered username in facade object
            if (id < 0)//checking to see if the username exsists in the database
            {
                unameError_label.Text = "Incorrect username";//if username doesnt exsist in db it gives error
            }

            else //if username exsists in db then on the basis of that username it selects the corresponding security question and answer along with the id of that row
            {sqFacade.selectSQ(uname, out ques, out answer, out std_id);
 
               // lbl_sq.Visible = true;
                securityQuestxt.Text = ques;//showing the question in textbox
              //  securityQuestxt.Visible = true;
              //  answersqtxt.Visible = true;
              //  btnSubmitAnswer.Visible = true;

            }
        
        }
           
        catch (Exception ee)//this is where the error occures...no idea why:(
        { 

            unameError_label.Text = ee.Message.ToString();
            
        }
        finally
        {
        }
    }

can anyone help in this regard...if u need more info plz do tell.
waiting for an immediate response...
tnx

Be a part of the DaniWeb community

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