2
Answers

login screen shows object referencenot setaninstanceofobject

Ask a question
narasiman rao

narasiman rao

11y
1.1k
1
protected void BtnLogin_Click(object sender, EventArgs e)
    {
        if (this.TxtUserName.Text.ToString().Trim() == "" | this.TxtPassword.Text.ToString().Trim() == "" )
        {
            Response.Write("<script>window.alert(' Invalid Entry !!! ')</script>");
            return;
        }
        
        SQl = "select * from login where username='" + this.TxtUserName.Text.ToString().Trim();
        SQl = SQl + "' and password='" + this.TxtPassword.Text.ToString().Trim();
        SQl = SQl + "' and active<>'D'";

        try
        {
            Dr = SCon.ReadSql(SQl);
            if (Dr.HasRows==false)
            {
                Response.Write("<script>window.alert(' Record not found !!! ')</script>");
                return;
            }
            Dr.Read();
            
    }
        catch (Exception e1)
        {
            Response.Write("<script>window.alert(' " + e1.Message.ToString()  + " ')</script>");
        }
    }

Answers (2)