n this code Snippet I am going to show how to use the Login Control with SQL for Authenticate UserName and password

PHP Code:
1.Place one Login Control Named Login1
2.
Declare Public Varriable named strErrorDescription 
Code:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        Boolean bauthenticated = false;
        bauthenticated = isValidUser(Login1.UserName, Login1.Password);
        if (bauthenticated)
        {
            e.Authenticated = true;
        }

        else
        {
            e.Authenticated = false;
        }
    }
Code For Validating userName and Password in SQLTable

This part of the code will check the username and password from the SQLTable
Code:
private Boolean isValidUser(string username, string pwd)
    {
        SqlConnection con = new SqlConnection("DataBase=Northwind;Server=(local);User ID=sa;Password=test");
        SqlCommand cmd = new SqlCommand("select * from users where userid='" + username + "'");// and pwd='" + pwd + "'");
        cmd.Connection = con;
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        con.Open();
        da.Fill(dt);
        con.Close();
        if (dt.Rows.Count == 0)
        {
            strLoginErrorMsg = "Invalid UserName";
            dt.Dispose();
            return false;
        }
        else
        {
            string strTemppwd=Convert.ToString(dt.Rows[0]["pwd"]).Trim();
            if (strTemppwd.ToLower() != Login1.Password.ToLower())
            {
                strLoginErrorMsg = "Invalid Password";
            }
        }
        return true;
       }


OverRide the ErrorMessage

Code:
protected void Login1_LoginError(object sender, EventArgs e)
    {
        Login1.FailureText = strLoginErrorMsg;
    }

Happy Coding