Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229328

Help me help me . i need a function get save json into sqllite database

$
0
0

@nguyentrunghieutcu This case you have to define SQLite table data structure according to json data field.

Here is demo code of SQLite Query structure in ionic,

First, you create table according to your required field like this,

this.database.executeSql('CREATE TABLE IF NOT EXISTS developer(id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT,skill TEXT,yearsOfExperience INTEGER)', {})
.then(res => console.log('table Created Successfully'))
.catch(e => console.log('table create err',e));

Now, you insert your json data in table like this,

this.database.executeSql("INSERT INTO developer(name, skill, yearsOfExperience) VALUES ('Simon', 'Ionic', '4')",{});


Viewing all articles
Browse latest Browse all 229328

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>