Hi,
I have been trying to fix this problem for a while unsuccessfully. I have the following code:
function dbInit() {
var db = LocalStorage.openDatabaseSync("ListViewTest", "",
"Wordlist", 1000000)
try {
db.transaction(function (tx) {
tx.executeSql(
'CREATE TABLE IF NOT EXISTS wordTable ( wordField TEXT, sectionField TEXT)')
console.log("Table created.")
})
} catch (err) {
console.log("Error creating table in database: " + err)
}
;
}
//Open database
function dbGetHandle() {
dbInit()
try {
var db = LocalStorage.openDatabaseSync("ListViewTest", "",
"Wordlist", 1000000)
} catch (err) {
console.log("Error opening database: " + err)
}
return db
}
//Read the wordField and sectionField content from the db
function dbGetWordList() {
var db = dbGetHandle()
db.transaction(function (tx) {
var results = tx.executeSql(
'SELECT wordField, sectionField FROM wordTable ORDER BY sectionField ASC ')
for (var i = 0; i < results.rows.length; i++) {
listModel.append({
"sectionField": results.rows.item(
i).sectionField,
"wordField": results.rows.item(i).wordField,
"checked": ""
})
}
})
}
When I run it it gives me the following error message:
Error: no such column: sectionField Unable to execute statement on the lineĀ
var results = tx.executeSql(
As far as I can see there is a sectionField column, but for some reason it is disregarded.
I would appreciate any input why this might be happening.
Thank you for your help.