Sqlite android.database.sqlite.SQLiteException

0

I have the following error:

  

android.database.sqlite.SQLiteException: near "@teste": syntax error (code 1):, while compiling: SELECT [email protected], test FROM user WHERE email = '[email protected]' AND password = 'test';

@Override
public User buscarEmailSenha(String email, String senha) {
    User user = null;
    Cursor cursor;

    String sql = sqliteHelper.NOME_TABELA + " WHERE email = '" + email
            + "' AND senha = '"+ senha +"' ;";
    String [] args = new String[] {email, senha};
    cursor = abrirBanco().query(sql, args, null, null, null, null, null);

    if(cursor.moveToFirst()) {
        user = new User();
        user.setEmail(cursor.getString(cursor.getColumnIndex("email")));
        user.setSenha(cursor.getString(cursor.getColumnIndex("senha")));
    }

    if (cursor != null)
        fecharBanco();
        return user;
}
    
asked by anonymous 16.10.2015 / 04:18

0 answers