`

database---query中selection用法和selectionArgs用法

 
阅读更多
public doQuery(long id, final String name) {  
  mDb.query("some_table", // table name   
        null, // columns  
        "id=" + id + " AND name='" + name + "'", // selection  
         //...... 更多参数省略  
  );  



public void doQuery(long id, final String name) {  
  mDb.query("some_table", // table name   
        null, // columns  
        "id=" + id + " AND name=?", // selection  
        new String[] {name}, //selectionArgs  
         //...... 更多参数省略  
  );  
  // ...... 更多代码  

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics