var databasewindow=Ti.UI.createWindow({
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
backgroundColor:"#bb7711",
color:"#fff",
font: { fontSize:48 },
fontFamily:'BurnstownDam-Regular',
layout: 'vertical'
});
var db=Titanium.Database.install('test.sqlite','test');
db.close();
var db = Ti.Database.open('test');
//db.execute('INSERT INTO test(name,age) VALUES('Humayoon','25')');
db.execute('INSERT INTO test(name) VALUES ("Humayoon")');
//db.execute('INSERT INTO test("name","age") VALUES ("'+'Zohaib'+'","'+'23'+'")');
var sql=db.execute('SELECT * FROM test');
while (sql.isValidRow())
{
//var cityId = sql.fieldByName('id');
var Name = sql.fieldByName('name');
//var cityContinent = sql.fieldByName('age');
Ti.API.info(Name);
sql.next();
}
sql.close();
db.close();
databasewindow.open();
错误
[错误]:TiExceptionHandler :(主要)[134,134] -----钛白 Javascript运行时错误----- [错误]:TiExceptionHandler :(主要)
[0,134] - 在app.js中:15,4 [错误]:TiExceptionHandler :(主要)
[1,135] - 消息:未捕获错误:没有这样的表:test(代码1):,
编译时:INSERT INTO test(name)VALUES(“Humayoon”)[ERROR]: TiExceptionHandler :( main)[0,135] - 来源:db.execute('INSERT INTO
test(name)VALUES(“Humayoon”)'); [错误]:V8异常:异常
发生在app.js:15:未捕获错误:没有这样的表:test(代码1):
,编译时:INSERT INTO test(name)VALUES(“Humayoon”)[ERROR] :文件:失败readDirectory()errno = 2