由网友(帆布鞋也比你高跟鞋优雅*)分享简介:我想找回在Android中两个日期之间的数据的SQLite 我在 SQLiteAdapter 类使用的一个功能。我的功能I want to retrieve data between two dates in Android SQLite I used one function in SQLiteAdapter cl...
我想找回在Android中两个日期之间的数据的SQLite
我在 SQLiteAdapter
类使用的一个功能。我的功能
I want to retrieve data between two dates in Android SQLite
I used one function in SQLiteAdapter
class. My function is
public void history(String startdate,String enddate) {
Cursor mCursor = db.rawQuery("SELECT * FROM "+ KK_AIRLINEBOOK +
" WHERE " + KEY_Bookingdate +
" BETWEEN " + startdate + " AND " + enddate , null);
}
但它不工作就说明附近语法错误和
推荐答案
将文字
public void history(String startdate,String enddate) {
Cursor mCursor = db.rawQuery("SELECT * FROM "+ KK_AIRLINEBOOK +
" WHERE " + KEY_Bookingdate +
" BETWEEN '" + startdate + "' AND '" + enddate + "'", null);
}
然而,它是更好,如果你使用selectionArgs两个
However it is better if you use selectionArgs
public void history(String startdate,String enddate) {
Cursor mCursor = db.rawQuery("SELECT * FROM "+ KK_AIRLINEBOOK +
" WHERE " + KEY_Bookingdate +
" BETWEEN ? AND ?", new String[]{startdate, enddate});
}
相关推荐
最新文章