I'm currently having a problem where when I try to insert data I'm receiving an error that the table column does not exist but I have defined it. I've currently isolated the problem and decided to insert data manually. Once I get past my alert('inserting data manually'), a popup shows with Error was could not prepare statement (1 table expenses has no column named expenseDate) (Code 5)
.
I have taken these SQL statements and tested them in a SQLite3 database, and everything checked out fine. The interesting thing is that when I go to my developer console->resources tab, I do not see my tables.
Any help would be appreciated.
My js is below:
var shortName='TravelExpenseReporting';
var version='0.1';
var displayName='TravelExpenseReporting';
var maxSize = 65536;
db = openDatabase(shortName,version,displayName,maxSize);
try {
db.transaction(
function(transaction) {
transaction.executeSql(
'CREATE TABLE IF NOT EXISTS expenses ' +
'(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ' +
'type TEXT NOT NULL, ' + 'amount DOUBLE NOT NULL, ' +
'vendor TEXT NOT NULL, ' + 'expensedate DATE NOT NULL);'
);
}
); // END transaction()
} catch(e) {
alert('error: ' + e);
return;
}
alert('inserting data manually');
try {
db.transaction(
function(transaction) {
transaction.executeSql(
'INSERT INTO expenses (type,amount,vendor,expensedate) VALUES (?,?,?,?);',
['expenseType',100,'vendor','01/01/2004'],
null,
errorHandler
);
}
); // END transaction()
} catch(e) {
alert('error: ' + e);
return;
}