第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在Android中使用SQLITE中的準備語句?

如何在Android中使用SQLITE中的準備語句?

素胚勾勒不出你 2019-06-23 17:04:14
如何在Android中使用SQLITE中的準備語句?如何在Android中使用SQLITE中的準備語句?
查看完整描述

3 回答

?
夢里花落0921

TA貢獻1772條經驗 獲得超6個贊

我總是在Android中使用準備好的語句,這很簡單:

SQLiteDatabase db = dbHelper.getWritableDatabase();SQLiteStatement stmt = db.compileStatement("SELECT * FROM Country WHERE code = ?");
stmt.bindString(1, "US");stmt.execute();


查看完整回答
反對 回復 2019-06-23
?
慕哥9229398

TA貢獻1877條經驗 獲得超6個贊

如果您希望返回一個游標,那么可以考慮如下所示:

SQLiteDatabase db = dbHelper.getWritableDatabase();public Cursor fetchByCountryCode(String strCountryCode){
    /**
     * SELECT * FROM Country
     *      WHERE code = US
     */
    return cursor = db.query(true, 
        "Country",                        /**< Table name. */
        null,                             /**< All the fields that you want the 
                                                cursor to contain; null means all.*/
        "code=?",                         /**< WHERE statement without the WHERE clause. */
        new String[] { strCountryCode },    /**< Selection arguments. */
        null, null, null, null);}/** Fill a cursor with the results. */Cursor c = fetchByCountryCode("US");
        /** Retrieve data from the fields. */String strCountryCode = c.getString(cursor.getColumnIndex("code"));
        /** Assuming that you have a field/column with the name "country_name" 
        */String strCountryName = c.getString(cursor.getColumnIndex("country_name"));

看這個片段女筆錄以防你想要一個更完整的。請注意,這是一個參數(shù)化SQL查詢,因此本質上它是一個準備好的語句。


查看完整回答
反對 回復 2019-06-23
  • 3 回答
  • 0 關注
  • 504 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號