Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:SQLiteException:并非所有设备上都存在错误_Android_Sqlite_Exception - Fatal编程技术网

Android:SQLiteException:并非所有设备上都存在错误

Android:SQLiteException:并非所有设备上都存在错误,android,sqlite,exception,Android,Sqlite,Exception,我在一台设备上得到这个错误,而在另一台设备上它工作正常。以下是错误: Caused by: android.database.sqlite.SQLiteException: not an error at android.database.sqlite.SQLiteQuery.nativeFillWindow(Native Method) at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:86)

我在一台设备上得到这个错误,而在另一台设备上它工作正常。以下是错误:

Caused by: android.database.sqlite.SQLiteException: not an error
    at android.database.sqlite.SQLiteQuery.nativeFillWindow(Native Method)
    at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:86)
    at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:164)
    at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:156)
    at com.Orange.MakeVisits.Themes.onCreate(Themes.java:162) 
我执行一个查询,在检查游标是否为null的行中,我得到这个错误。这是我的密码:

    String stmtGetThemes = "SELECT * FROM pr_fields_descriptor a "
   + "inner join pr_fields_starring b on a.id_fields_descriptor = b.fields_descriptor_id "
   + "where b.starring_id = '"+pos_starring_id+"' and a.theme_id='"+themes_ids[m]+"' order by form_rank";

    Cursor getThemesCursor1 = db.databaseQuery(stmtGetThemes);

    if (getThemesCursor1!=null && getThemesCursor1.getCount()>0){
    //----
    }
databasequery就是这个方法(在扩展
SQLiteOpenHelper
的类中定义):

知道是什么导致了这个错误吗?声明不好?为什么它能在其他设备上工作?
任何想法都欢迎。感谢您的建议。

不要在查询中传递数组类型参数,有时它不会工作

int themes_id = themes_ids[m];

String stmtGetThemes = "SELECT * FROM pr_fields_descriptor a inner join pr_fields_starring b on a.id_fields_descriptor = b.fields_descriptor_id where b.starring_id = '"+pos_starring_id+"' AND a.theme_id = '"+themes_id+"' ORDER BY form_rank";

Cursor getThemesCursor1 = db.databaseQuery(stmtGetThemes);

if (getThemesCursor1 != null && getThemesCursor1.getCount() != 0){
//----
}

请不要以“;”结束此查询。

我如您所说更改了,但仍会崩溃。请检查空格是否正确使用。我看不到任何可能导致其崩溃的空格。“form_rank”是什么?它是数据库列还是变量名现在请完全检查我的答案,如果
pos\u starring\u id
themes\u id[m]
是整数,您应该从查询中删除它们周围的引号(
)标记,这样它们就不会被视为字符串。
int themes_id = themes_ids[m];

String stmtGetThemes = "SELECT * FROM pr_fields_descriptor a inner join pr_fields_starring b on a.id_fields_descriptor = b.fields_descriptor_id where b.starring_id = '"+pos_starring_id+"' AND a.theme_id = '"+themes_id+"' ORDER BY form_rank";

Cursor getThemesCursor1 = db.databaseQuery(stmtGetThemes);

if (getThemesCursor1 != null && getThemesCursor1.getCount() != 0){
//----
}
String stmtGetThemes = "SELECT * FROM pr_fields_descriptor a "
   + "inner join pr_fields_starring b on a.id_fields_descriptor = b.fields_descriptor_id "
   + "where b.starring_id = '"+pos_starring_id+"' and a.theme_id='"+themes_ids[m]+"' order by form_rank";