使用 Titanium appcelerator.如何使用单击按钮激活的 sql 查询对我的数据库进行排序.到目前为止,我的代码是:
Using Titanium appcelerator. How can i sort my database with an sql query which is activated on a button click. my code so far is:
SortButton.addEventListener('click',function(e){
sortList();
});
function sortList()
{
db.execute("SELECT * FROM SavedList ORDER BY SavedListed ASC");
}
你的代码 : db.execute("SELECT * FROM SavedList ORDER BY SavedListed ASC");是正确的.只需在 db.execute 之前打开数据库并在 db.execute 之后关闭它.它会起作用.
Your code : db.execute("SELECT * FROM SavedList ORDER BY SavedListed ASC"); is correct. Just open database before db.execute and close it after db.execute. It will work.
打开数据库:var db = Ti.Database.open('databaseName');
To open database : var db = Ti.Database.open('databaseName');
关闭数据库:db.close();
To close database: db.close();
这篇关于Titanium sqlite ORDER BY 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!