Android android.database.sqlite.SQLiteException: unrecognized token: “1704266282226.jpg“ (code 1):

报错原文

android.database.sqlite.SQLiteException: unrecognized token: "1704266282226.jpg" (code 1): , while compiling: select *from cloud_album_table where photoName = 1704266282226.jpg

错误写法

final String sql ="select *from cloud_album_table where photoName = 1704266282226.jpg";
Cursor cursor = db.rawQuery(sql, null);

正确写法

final String sql ="select *from cloud_album_table where photoName = ?";
Cursor cursor = db.rawQuery(sql, new String[]{
    
    "1704266282226.jpg"});

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/135365467