title: Prepared statement and setString
body: <p>I have a problem with <code>setString</code>. When I add <code>%</code> to the parameter in the <code>setString</code>, it works even if I don't write anything. However, when I remove it it doesn't work. Can anyone help?</p>
  
  <pre><code>String Id= User1.getText().toString();
  String Passwords = Pass.getText().toString();
  
  
  btnlogin.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
           String query = "SELECT * FROM TABLE WHERE id LIKE ? AND pass LIKE ? ";
              try {
                  if (connect != null) {
                     PreparedStatement statement = connect.prepareStatement(query);
                  statement.setString(1, Id );  //  statement.setString(1 ,"%" + Id + "%");
                 statement.setString(2 ,Passwords);//  statement.setString(2 ,"%" + Passwords + "%");
                     r = statement.executeQuery();
                      if (r.next()){
  
                          Intent intent = new Intent();
                          intent.setClass(Login.this, MainActivity.class);
                          startActivity(intent);
                              }
                       else {
                          message = "Error";
                          info.setText(message);
                      }
  
                  } else {
                      message = "Error in connection with SQL server";
                      info.setText(message);
                  }
  
  
              } catch (SQLException e) {
                  etat = false;
                  message = "Got an exception!";
                  System.err.println(e.getMessage());
              }
  
  
      }});  }
  </code></pre>
  
  <p>P.S: I get no errors</p>