怎樣對android開發中的sqlite資料庫進行凝查詢

2021-12-22 13:49:08 字數 1363 閱讀 1931

1樓:匿名使用者

android中sqlite模糊查詢,可以直接使用cursor 的query加入模糊查詢的條件即可。

使用query有如下方式:

1.使用這種query方法%號前不能加',以下為示例**:

cursor c_test = mdatabase.query(tab_name, new string, tab_field02+" like ? ",

new string , null, null, null);

2.使用這種query方法%號前必須加',以下為示例** :

cursor c_test=mdatabase.query(tab_name, new string,tab_field02+" like '%" + str[0] + "%'", null, null, null, null);

3.使用這種方式必須在%號前加' ,以下為示例** :

string current_sql_sel = "select * from "+tab_name +" where "+tab_field02+" like '%"+str[0]+"%'";

cursor c_test = mdatabase.rawquery(current_sql_sel, null);

2樓:團隊讀書控

sqliteopenhelper dbhelper=new mydatebase(androidproject_sqliteactivity.this,"mydatabase2");

sqlitedatabase db=dbhelper.getreadabledatabase();

cursor cur=db.query("user", new string, "id like ?", new string, null, null, null);

while(cur.movetonext())

3樓:匿名使用者

// select * from users where name like %searcherfilter% or telnumber like %telnumber%;

public list> querybylike(string searcherfilter) {

cursor cursor = db.query(table_name, null, "name like '%" + searcherfilter + "%' or telnumber like '%" + searcherfilter + "%'", null, null, null, null);

這個是不是你要的!!

關於android中使用sqlite資料庫的查詢基本操作.貼上**. 40

android手機的apk檔案中的classde檔案是什麼?是

dex是安卓上的應用程式apk中提取出來的可執行檔案,即將apk中的classes.dex檔案通過dex優化過程將其優化生成乙個 dex檔案單獨存放,原apk中的classes.dex檔案會保留。所謂dex,是由android軟體中的classes.dex生成的,dex化即是把那個檔案預先提取出來作...

android怎麼實現後臺對按鍵事件的監控

您好,很高興能幫助您 遙控器按鍵事件這個不是在android原始碼的bootable下面ircon.c配置的麼。比如 遙控器按鍵編號是 0x0b 給他的響應是 key up 就是方向鍵的下,這個是在原始碼裡邊配置的。你必須要有遙控器的書名數,知道遙控器每個按鍵的編號,然後對應給他相應的響應才可以。但...

西部大開發是怎樣開發的

資料 提到西部大開發相信我們每個人對這個口號都不陌生,但西部到底在怎麼開發我估計不知道的人真是太多了,好多人還矇在鼓裡。沒有真正來到西部你就不要說自己瞭解西部大開發,如果你真瞭解的話,估計你已經投身西部了。近幾年來國家領導人一直在提倡畢業大學生奔赴西部支援西部開發,但好多人都不屑一顧,因為不知道去那...