欢迎投稿

今日深度:

android数据库sqlite 不支持select top 10的写法,androidsqlite

android数据库sqlite 不支持select top 10的写法,androidsqlite


改成 select * from tablename desc limit 0,9 就可以了

比如

 // 获取前十条记录  
    public List<Payment> GetPayListTopTen() {
        List<Payment> userList = new ArrayList<Payment>();
        Cursor cursor = db.rawQuery("select * from account desc limit 0,9", null);
        cursor.moveToFirst();
        while (!cursor.isAfterLast() && (cursor.getString(1) != null)) {
        	Payment pay = new Payment();
        	pay.setId(cursor.getInt(0));
        	pay.setMoney(cursor.getString(1));
        	pay.setText(cursor.getString(2));
        	pay.setTime(cursor.getString(3));

            userList.add(pay);
            cursor.moveToNext();
        }
        cursor.close();
        return userList;
    }


www.htsjk.Com true http://www.htsjk.com/SQLite/35962.html NewsArticle android数据库sqlite 不支持select top 10的写法,androidsqlite 改成 select * from tablename desc limit 0,9 就可以了 比如 // 获取前十条记录 public ListPayment GetPayListTopTen() { ListPayment userList = new ArrayListPa...
相关文章
    暂无相关文章
评论暂时关闭