gpt4 book ai didi

java - Android SQLite COLLATE NOCASE 语法错误

转载 作者:搜寻专家 更新时间:2023-10-30 22:09:29 25 4
gpt4 key购买 nike

<分区>

我正在数据库中搜索,我想在任何情况下(UPPER lower 或 Mix)获取数据。我发现 COLLATE NOCASE 可以解决问题,但它会导致错误。

正如您在此处看到的查询...

android.database.sqlite.SQLiteException: near "COLLATE_NOCASE": syntax error (code 1): , while compiling:

Select 
_ID, Name, Surname, Username, Password, Roll
From
USER
Where
name = 'Danyal Ahmed'
and surname = 'CHAUDHRY' COLLATE_NOCASE;

感谢任何帮助。

03-04 23:41:06.760 28952-28952/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.danyalahmed.stockmanagement, PID: 28952 android.database.sqlite.SQLiteException: near "COLLATE_NOCASE": syntax error (code 1): , while compiling: Select _ID, Name, Surname, Username, Password, Roll FROM USER where name = 'Danyal Ahmed' and surname = 'CHAUDHRY' COLLATE_NOCASE; at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:895) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:506) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316) at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255) at com.example.danyalahmed.stockmanagement.Classes.DbAdapter.getData(DbAdapter.java:113) at com.example.danyalahmed.stockmanagement.Activities.Users$1.onItemSelected(Users.java:83) at android.widget.AdapterView.fireOnSelected(AdapterView.java:914) at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:903) at android.widget.AdapterView.access$300(AdapterView.java:48) at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:873) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:211) at android.app.ActivityThread.main(ActivityThread.java:5373) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

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