Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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()
— asked April 9th 2010 by Mark Peace
  • android
  • database
0 Comments

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

    — answered April 9th 2010 by Damien Elmes
    permalink
    0 Comments
  • 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.

    — answered April 9th 2010 by Don Thorp
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.