Hi all
I am building a hybrid web app in SMP using phonegap and html.
I am trying to insert records in sql database but i get an error with an undefined error code
Please see below :
function openDatabaseFoo() {
db = window.openDatabase(clientDBName, clientDBVersion, clientDBDisplayName, clientDBMaxSize);
}
function createDBTables() {
db.transaction(function(tx) {
// Create mine table
var fooCreate = 'CREATE TABLE IF NOT EXISTS ' + fooTable+ ' (empNo, empName)';
tx.executeSql(fooCreate , [],
function (tx, resultSet) {
//success
var msg = 'Sucessfully created';
alert(msg);
logSuccessMessage(msg);
},
function (err) {
//error code
var msg = "Error creating table = " + err.code;
alert(msg);
logErrorMessage(msg);
}
);
}
the creation of tables is happening properly because i am getting a success message in the alerts.
I am getting the error when i am trying to insert records in the above table
function insertDataTable(){
db.transaction(function(tx) {
var insertSql = 'INSERT INTO ' + fooTable + ' (empNo, empName) VALUES ("1603","baker")';
tx.executeSql(insertSql, [],
function (tx, resultSet) {
//success
var msg = 'Sucessful insertingdata.';
alert(msg);
logSuccessMessage(msg);
},
function (err) {
//error code
var msg = "Error inserting data sql = " + insertSql + " Error code = " + err.code;
alert(msg);
logErrorMessage(msg);
}
);
}
can some one please help.Also guide me where can i check the sqlLite database logs to see more about the error.
I would really appreciate the help.I have been onto this since past few days now
Regards
Shweta