2017-04-16 176 views
0

我想從本地存儲搜索,這將是什麼Sqlite查詢Ionic2的 - 什麼是SQL查詢從本地存儲搜索號碼。 就像這樣 - 從mytable中選擇row_id,其中* like'%search_text%';SQLite搜索查詢

var searchmobile=newvalue 
      this.database.executeSql("SELECT mobile_no FROM customer WHERE mobile_no like ?", 
      [searchmobile]).then((customerdata) => 
+0

http://stackoverflow.com/questions/12613926/sqlite-query打開數據庫像 –

+0

@suraj我必須通過一個變量「searchmobile」,該怎麼做? –

回答

0

嘗試串聯searchmobile,如:

var searchmobile=newvalue 
      this.database.executeSql("SELECT mobile_no FROM customer WHERE mobile_no like ?", 
      ['%' + searchmobile + '%']).then((customerdata) => 
0

u需要執行一個查詢之前

`var searchmobile=newvalue 
this.database = new SQLite(); 
this.database.openDatabase({ 
     name: "data.db", 
     location: "default" 
     }).then(() => { 
this.database.executeSql("SELECT mobile_no FROM customer WHERE mobile_no like ?", 
      [searchmobile]).then((customerdata) =>`