Database on Android
Hi,
I'm trying to get a database working on Android, using the example code below, but I keep getting the error: cannot read property "rowCount" from null.
Any clues?
M.
var testDatabase = Titanium.Database.open("testDB;")
testDatabase.execute('CREATE test (id INTEGER, value TEXT)');
testDatabase.execute("INSERT INTO test (id, value) (1,'test');")
var results = testDatabase.execute ("SELECT * FROM test");
alert (results.rowCount);
testDatabase.remove()
2 Answers
-
is the db opening correctly? turn on trace level debugging to find out. that semicolon in the open call looks spurious too, though it probably isn't causing a problem
-
You'll currently get a null resultset if there is an exception in the native layer. As Damien mentioned the error will be in the Trace level log.