Caused by: android.database.sqlite.SQLiteException: near "xxxx"
来源:互联网 发布:网页优化怎么做 编辑:程序博客网 时间:2024/05/23 13:30
</pre>先看错误:<pre name="code" class="plain">08-16 11:06:31.221: E/AndroidRuntime(12581): Caused by: android.database.sqlite.SQLiteException: near "ID": syntax error (code 1): , while compiling: SELECT * FROM cart c INNER JOIN food f ON c.foodID=f.food ID08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at com.xxx.xxxxx.xxxxx.xxx.query(CartProvider.java:35)(应用包名)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.content.ContentProvider.query(ContentProvider.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.content.ContentProvider$Transport.query(ContentProvider.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.content.ContentResolver.query(ContentResolver.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.content.ContentResolver.query(ContentResolver.java)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)08-16 11:06:31.221: E/AndroidRuntime(12581): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)08-16 11:06:31.221: E/AndroidRuntime(12581): at java.util.concurrent.FutureTask.run(FutureTask.java:234)08-16 11:06:31.221: E/AndroidRuntime(12581): ... 3 more
出现这种错误,一般都是SQL语句拼写错误,或者使用androidApi的使用错误,仔细检查一下一的sql语法是否错误.
请看我的错误:
很明显 foodID有一个空格,错误就在这里.
0 0
- Caused by: android.database.sqlite.SQLiteException: near "xxxx"
- Caused by: android.database.sqlite.SQLiteException: no such column:
- Caused by: android.database.sqlite.SQLiteException: unable to open database file
- Caused by: android.database.sqlite.SQLiteException: no such table: _table_case (code 1):
- android.database.sqlite.SQLiteException: near "where": syntax error (code 1): ,
- android.database.sqlite.SQLiteException: database is locked
- android.database.sqlite.SQLiteException: no such column
- Android SQLite 错误 SQLiteException: near "group": syntax error
- android.database.sqlite.SQLiteException: unable to open database file
- android.database.sqlite.SQLiteException: only a single result allowed for
- android.database.sqlite.SQLiteException: no such table解决方法
- greenDao使用中android.database.sqlite.SQLiteException: no such table
- E/AndroidRuntime(1017): Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unable t
- Caused by: android.database.sqlite.SQLiteDatabaseCorruptException: file is encrypted or is not a dat
- Android Studio中使用SQLite问题:android.database.sqlite.SQLiteException: no such table: XXX (code 1)
- android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 0 to 1:解决
- android.database.sqlite.SQLiteException: Can't downgrade database from version 42 to 41
- android报 android.database.sqlite.SQLiteException: no such table: xxx (code 1): , while compiling
- 【HDU】1529 Cashier Employment 差分约束
- WordPress插件 Foxlogin 连接腾讯QQ与新浪微博接入登录[v1.0]
- C++杂谈之关于文件操作的若干问题
- Android WiFi系统
- Flatten Binary Tree to Linked List
- Caused by: android.database.sqlite.SQLiteException: near "xxxx"
- C#开发编码规范
- Git简介
- WordPress主题 Magazine 汉化杂志新闻资讯高级模板[更新2.5.2]
- Leetcode练习-Add Two Number
- poj2464 Brownie Points II 树状数组
- POJ3342 Party at Hali-Bula 树形DP
- git使用入门
- Mac OSX 快捷键