object-layer / cordova-sqlite-plugin

Cordova SQLite plugin with a straightforward low-level API
Other
5 stars 15 forks source link

Create new database #8

Closed Rombersoft closed 7 years ago

Rombersoft commented 7 years ago

I've tried to create new database but I did not opened connection. There is my code:

var SQLite = window.cordova.require('cordova-sqlite-plugin.SQLite');

var sqlite = new SQLite('waste.db');

sqlite.open(function(err) { if (err) throw err; //ERROR HERE!!! sqlite.query('CREATE TABLE DataM (Name VARCHAR (100) NOT NULL, Price DECIMAL NOT NULL, Quantity INT NOT NULL, Date DATETIME NOT NULL', [], function(err, res) { if (err) throw err; console.log(res.rows[0].solution); }); });

Error: "add.js:47 Uncaught Error: SQLite Error: cannot open database 'waste.db' at Object.error [as fail] at Socket. (http://localhost:40779/simulator/app-host.js:144:31) at Socket.Emitter.emit (http://localhost:40779/simulator/thirdparty/socket.io.js:4:10860) at Socket.onevent (http://localhost:40779/simulator/thirdparty/socket.io.js:4:5790) at Socket.onpacket (http://localhost:40779/simulator/thirdparty/socket.io.js:4:5306) at Manager. (http://localhost:40779/simulator/thirdparty/socket.io.js:4:9520) at Manager.Emitter.emit (http://localhost:40779/simulator/thirdparty/socket.io.js:4:10860) at Manager.ondecoded (http://localhost:40779/simulator/thirdparty/socket.io.js:3:31751) at Decoder. (http://localhost:40779/simulator/thirdparty/socket.io.js:4:9520) at Decoder.Emitter.emit (http://localhost:40779/simulator/thirdparty/socket.io.js:3:3710)"

I use intel XDK 3900, necessary plugin is added

mvila commented 7 years ago

I am sorry but I've only tested this plugin on iOS and I cannot help you with other environments.

Rombersoft commented 7 years ago

Hello friends. I give up Cordova and learn xamarin. So good luck you in developing this shit