android.database.sqlite.SQLiteException:没有这样的列database、android、SQLiteException、sqlite

2023-09-05 00:14:33 作者:触碰岁月

当我执行此查询时得到android.database.sqlite.SQLiteException:没有这样的列'有什么错误?

 公开光标Getupdate(字符串RID)抛出的SQLException
        {

光标m1Cursor = db.rawQuery(选择_id不能满足,其中满足=+去掉,NULL);
    如果(m1Cursor!= NULL){
        如果(m1Cursor.getCount()大于0)
        {

             m1Cursor.moveToFirst();
        }
    }
 返回m1Cursor;
}
 

的logcat

  1月5号至28号:22:27.999:E / AndroidRuntime(1411):致命异常:主要
1月五日至28日:22:27.999:E / AndroidRuntime(1411):android.database.sqlite.SQLiteException:没有这样的列:ttyuhomk:在编制:选择_id不能满足的地方相遇=愤怒
 
怎样查看 android sqlite数据库

解决方案

对于字符串数据类型总是用引号像这样的+摆脱+'自从摆脱为String你得到的错误。

您应该使用 +摆脱仅在排除数据类型为int。

when i execute this query i get 'android.database.sqlite.SQLiteException: no such column' what is the error?

    public Cursor Getupdate(String rid) throws SQLException 
        {

Cursor m1Cursor = db.rawQuery("SELECT _id FROM  Meeting   where meet="+rid , null);
    if (m1Cursor != null) {           
        if(m1Cursor.getCount() > 0)
        {

             m1Cursor.moveToFirst();
        }
    }
 return m1Cursor;
}

logcat

05-28 01:22:27.999: E/AndroidRuntime(1411): FATAL EXCEPTION: main
05-28 01:22:27.999: E/AndroidRuntime(1411): android.database.sqlite.SQLiteException: no such column: ttyuhomk: , while compiling: SELECT _id FROM  Meeting where meet=rage

解决方案

For string data type always use quotes like this '"+rid+"'" since rid is String you get error.

You should use +rid only if rid is int.