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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

FastAPI + Tortoise ORM + FastAPI Users (Python) - Relationship - Many To Many(FastAPI+Tortoise ORM+FastAPI用户(Python)-关系-多对多)
How to make node.js mysql connection pooling available on startup(如何使node.js MySQL连接池在启动时可用)
Window functions not working in pd.read_sql; Its shows error(窗口函数在pd.read_sql中不起作用;它显示错误)
(Closed) Leaflet.js: How I can Do Editing Geometry On Specific Object I Select Only?((已关闭)Leaflet.js:如何仅在我选择的特定对象上编辑几何图形?)
in sqlite update trigger with multiple if/Case Conditions(在具有多个IF/CASE条件的SQLite UPDATE触发器中)
Android: Why is Room so slow?(Android:为什么Room这么慢?)