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

2024-01-09

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

    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

对于字符串数据类型,始终使用这样的引号'"+摆脱+"'"由于 rod 是 String 你会得到错误。

你应该使用+rid仅当 Rid 为 int 时。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

android.database.sqlite.SQLiteException:没有这样的列 的相关文章

随机推荐