gpt4 book ai didi

java - 执行查询时出现 SQLiteException

转载 作者:行者123 更新时间:2023-11-30 04:20:13 26 4
gpt4 key购买 nike

我想执行一个 ManagedQuery 但我在我的日志中收到一个错误:

查询

 Cursor cursor = managedQuery(GroceryListContentProvider.NOTES_URI,projection,Notes.NOTE_TITLE+"="+S+" AND "+ Notes.NOTE_DATE+"="+S1, null, null);

错误日志

02-21 16:00:52.395: E/AndroidRuntime(22534): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.schuemie.GroceryList/net.schuemie.GroceryList.shoppinglist}: android.database.sqlite.SQLiteException: near "new": syntax error: , while compiling: SELECT item_name FROM notes WHERE (title=shop new AND date=12/2/12) ORDER BY title

最佳答案

从查询中删除“new”并为字符串值添加引号

SELECT item_name FROM notes WHERE (title='shop' AND date=12/2/12) ORDER BY title

关于java - 执行查询时出现 SQLiteException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9376361/

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