小编Noo*_*oby的帖子

离子executeSql不起作用

我实际上尝试使用SQLite制作移动应用程序.我试着创建两个表:

constructor(private sqlite:SQLite,public modalCtrl: ModalController,public navCtrl: NavController, private navParam: NavParams, private databaseprovider: DatabaseProvider, private employeesProvider: EmployeeProvider) {
    this.createDetabaseFile();
}

private createDetabaseFile() : void {
    this.sqlite.create({
          name: DATABASE_FILE_NAME,
          location: 'default'
    }).then((dbRes: SQLiteObject) => {
        alert("bdd créée");
        this.db = dbRes;
        this.createTables();
    })
}

private createTables() : void {
    this.db.executeSql('CREATE table IF NOT EXISTS  symbole(id INTEGER NOT NULL ,name TEXT)',{})
        .then(() => {
            alert("table symbole created");
            this.db.executeSql('CREATE table IF NOT EXISTS representationPhoto(name VARCHAR(32))',{})
                .then(() => {
                    alert("table representationPhoto created");
                })
            .catch(e => alert("erreur …
Run Code Online (Sandbox Code Playgroud)

sqlite mobile ionic-framework

6
推荐指数
1
解决办法
255
查看次数

标签 统计

ionic-framework ×1

mobile ×1

sqlite ×1