2017-04-16 218 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) =>`