lundi 7 septembre 2015

error with my cursor

first i want to get the id by finding the row with String and get the id. then i want to display one record that is more than my id. id have to methods in my dbHandler:

public int Review_id(String word){

    Cursor c = database.rawQuery( "SELECT * FROM test2 WHERE name Like '"+word+"'", null);
    c.moveToFirst(); 

    int r=c.getInt(0);
    return r;


}


public String Move_To_Next(String word){

    Cursor c = database.rawQuery( "SELECT * FROM test WHERE id > '"+word+"' ORDER BY id asc", null);
    c.moveToFirst();

    String r=c.getString(1);
    return r;


} 

and my code in Main.class is:

    btn.setOnClickListener(new OnClickListener(){

        @Override
        public void onClick(View arg0) {





            db.open();

            tv.setText(db.Move_To_Next(tv.getText().toString()));

            db.close();


        }



    });

WHAT IS THE PROBLEM????

Aucun commentaire:

Enregistrer un commentaire