0

I am inserting values into table people, suppose if I enter 1,Ram,22,98; 1,Kri,22,83; 1,Sam,23,47;

While getting it back the the cursor is starting from 1,Sam,23,47; 1,Kri,22,83;
1,Ram,22,98; I am not able to figure out the error. any sort of help is welcome!

Create table People(id integer ,Name text,Age int,pplid primary key not null);

INSERT INTO People(id,Name,Age, pplid) VALUES (?,?,?,?); 

_statement = _dbTopNews.createStatement("Select * from People where id = 10;");
_statement.prepare();

Cursor _cursor = _statement.getCursor();
Row _row;
_vecTopNews = new Vector();

while(_cursor.next()){

_custObj = new CustomObj();
_row = _cursor.getRow();

_id = _row.getString(0);
_name = _row.getString(1);
_age = _row.getString(2);
_pplid = _row.getString(3);

_custObj.setID(_id );
_custObj.setName(_name );
_custObj.setAge(_age );
_custObj.setPplId(_pplid );

_vec = new Vector();

}
Mat
  • 202,337
  • 40
  • 393
  • 406
varunrao321
  • 925
  • 2
  • 10
  • 18

1 Answers1

1

You should use id as index column, unique value for example 1,Ram,22,98; 2,Kri,22,83; 3,Sam,23,47 and then the sql statement will be "Select * from People where id = 10 ORDER by id;"

JustMe
  • 732
  • 1
  • 11
  • 16
  • thanks for your reply JustMe, for the requirement of my application I set pplid as primarykey, it has unique value, let me try ORDER by on pplid – varunrao321 Nov 05 '11 at 10:25
  • Thank you very much JustME, I should have spent some more time on sqlite querys before posting this thread.. – varunrao321 Nov 05 '11 at 10:38