sqlite - Unbale 在 Ionic 4 中使用 SQLite 创建表
问题描述
以下是我的组件代码
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
constructor(private sqlite: SQLite){
this.createTransactions();
}
createTransactions(){
this.sqlite.create({
name: 'sample.db',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('CREATE TABLE IF NOT EXISTS transactions(transaction_id TEXT PRIMARY KEY, user_id TEXT, order_date DATE, order_number INTEGER, invoice_date DATE, processed_date DATE, transaction_amount FLOAT)')
.then(res => alert('Executed SQL'))
.catch(e => alert('cannot create table'+JSON.stringify(e))); //alerting this
}).catch(e => alert('lite'+JSON.stringify(e)));
}
有人可以告诉我哪里做错了吗?
解决方案
推荐阅读
- flutter - 从 GraphQL Flutter 获取原始 json
- c++ - 网格最近邻 BFS 慢
- python - 如何在不是代码的循环中运行代码
- mongodb - MongoDB 分片更好的模式:db normalized Vs db non normalized
- ios - 每日本地通知不起作用
- html - 显示:CSS 中的内联块
- python - 如果第二个元素等于 Numpy 中的所需数字,如何增加行中的第一个元素?
- javascript - 我的页面上有多个表单会触发意外行为
- r - 如何在 R 中使用条件 if 更改矩阵条目
- c# - 使用实体框架核心模型时 WPF 数据网格未更新