Hi My code is giving me a red line under '.createStatement()' and I really don't know why and how to fix it.

    @Override
    protected String doInBackground(String... params) {
    if(userid.trim().equals("")|| password.trim().equals(""))
        z = "Please enter User Id and Password";
    else
    {
        try {
            connection con = (connection) connectionClass.CONN();
            if (con == null) {
                z = "Error in connection with SQL server";
            } else {
                String query = "select * from Usertbl where UserId='" + userid + "' and password='" + password + "'";

               Statement stmt = con.createStatement();

                ResultSet rs = stmt.executeQuery(query);

                if(rs.next())
                {

                    z = "Login successfull";
                    isSuccess=true;
                }
                else
                {
                    z = "Invalid Credentials";
                    isSuccess = false;
                }

            }
        }
        catch (Exception ex)
        {
            isSuccess = false;
            z = "Exceptions";
        }
    }
    return z;
}
}

Edited 5 Months Ago by sup_1

Class names usually begin with a capital letter, eg Connection. (Java is case-sensitive)

Re your catch block:
If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you.
ALWAYS put an e.printStackTrace(); in your catch blocks until/unless you have a good reason to do something else

Edited 5 Months Ago by JamesCherrill