首页 > 解决方案 > 使用 SQLite TypeError:无法读取 null 的属性“事务”

问题描述

我使用 ionic4 + angular8 代码流:

在此处输入图像描述

错误代码:

在此处输入图像描述

请帮我。谢谢你。

此处的错误代码 在此处 输入图像描述

标签: ionic4

解决方案


您已经编写了事务,但是我告诉您 SQLite 插件中没有事务的属性,您需要添加 write create 属性,无论是打开还是创建数据库。喜欢=>

this.sqlite.create({
  name: 'data.db',
  location: 'default'
})
  .then((db: SQLiteObject) => 

db.executeSql('create table danceMoves(name VARCHAR(32))', [])
  .then(() => console.log('Executed SQL'))
  .catch(e => console.log(e));
  })

  .catch(e => console.log(e));

推荐阅读