Titanium sqlite ORDER BY 语句

2023-04-02数据库问题
4

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

The End

相关推荐

连接远程SQL Server数据库的经典ASP问题
Classic ASP problem connecting to remote SQL Server database(连接远程SQL Server数据库的经典ASP问题)...
2024-04-16 数据库问题
4

在 TFS 中映射本地目录时发生数据库错误(SQL 错误 18054)
Database error occurred (SQL error 18054) when mapping local directory in TFS(在 TFS 中映射本地目录时发生数据库错误(SQL 错误 18054))...
2024-04-16 数据库问题
4

无法使用 Node.js 和 Tedious 连接到 SQL Server
Cannot connect to SQL Server with Node.js and Tedious(无法使用 Node.js 和 Tedious 连接到 SQL Server)...
2024-04-16 数据库问题
51

在 SQLite 中按月分组
Group by month in SQLite(在 SQLite 中按月分组)...
2024-04-16 数据库问题
6

使用 Dapper 删除超过 2100 行(按 ID)的正确方法
Correct method of deleting over 2100 rows (by ID) with Dapper(使用 Dapper 删除超过 2100 行(按 ID)的正确方法)...
2024-04-15 数据库问题
11

如何从 Python 中的数据库创建 CSV 文件?
How do I create a CSV file from database in Python?(如何从 Python 中的数据库创建 CSV 文件?)...
2024-04-15 数据库问题
3