Titanium sqlite ORDER BY 语句

Titanium sqlite ORDER BY statement(Titanium sqlite ORDER BY 语句)
本文介绍了Titanium sqlite ORDER BY 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

使用 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 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Cannot connect to SQL Server with Node.js and Tedious(无法使用 Node.js 和 Tedious 连接到 SQL Server)
Group by month in SQLite(在 SQLite 中按月分组)
How do I create a CSV file from database in Python?(如何从 Python 中的数据库创建 CSV 文件?)
How will a promisified mysql module work with NodeJS?(一个promisified mysql 模块将如何与NodeJS 一起工作?)
SQLite3 and multiple processes(SQLite3 和多个进程)
How to import CSV into sqlite using RSqlite?(如何使用 RSqlite 将 CSV 导入 sqlite?)