gpt4 book ai didi

ios - 如何在 fmdb 数据库中使用 limit 和 order by 子句来检索表数据?

转载 作者:行者123 更新时间:2023-11-29 12:38:24 47 4
gpt4 key购买 nike

我正在为我的 iOS 应用程序使用 FMDB 数据库,我想使用 order by 和 limit 子句检索表数据,但 FMDB 给出以下错误。

我正在发布我的查询语句和错误消息。

查询-

 [cmdatabase open];
NSString *query =
[NSString stringWithFormat:@"select * from MessagesTable where fromUserName=%@ OR toUserName=%@ ORDER BY messageTimestamp DESC LIMIT %d",
userName, userName, limetNo];

FMResultSet *results = [cmdatabase executeQuery:query];

错误信息-

Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) 
[mozIStorageConnection.createStatement]

最佳答案

尽量不要使用 *,而是写 select from。我在 sqlite 中遇到了一些问题。

关于ios - 如何在 fmdb 数据库中使用 limit 和 order by 子句来检索表数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25663441/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com