java - SQLite date query returns no record -


i developing android application search records created after given date. code thing this

public list<nprmember> incrementaldata(string lastdttime) {  list<nprmember> results = new arraylist<nprmember>(); sqlitedatabase db=getmyreadabledatabase(); string lastdt="datetime("+lastdttime+")"; cursor cursor = null;  try{        cursor = db.query(table_name_npr, new string[] { key_fullname, key_fathername,         key_rcrd_source,key_rcrd_crn_date},key_rcrd_crn_date + ">? , "+key_rcrd_source+">?",                new string[]{lastdt, "0"}, null, null, null);        cursor.movetofirst();     while (!cursor.isafterlast()) {             nprmember nprmem = cursortomemberdetails(cursor);             results.add(nprmem);                       cursor.movetonext();      } }catch(exception e){     log.e(app_name, "an error occurred while searching "+lastdttime+": "+e.tostring(), e); }finally{     if(cursor!=null && !cursor.isclosed()){         cursor.close();     } }  return results; 

}

the query not return value, although have @ least 1 record key_rcrd_crn_date 2013-07-25 18:59:19 lastdttime passed parameter has value 2013-07-25 14:46:03. 1 interesting thing if run query @ sqlite command prompt returns deisred record.

  select fullname, fathername, .... rcrdsource, rcrdcrtndate nprmembers rcrdcrtndate>'2013-07-25  14:46:03' , rcrdsource>0; 

any appreciated. thanks

the parameter value (in lastdt) wrong.

what want string 2013-07-25 18:59:19, using string datetime(2013-07-25 18:59:19). letter d comes after 2, no record matches.

change initialization of lastdt to:

string lastdt=lastdttime; 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -