gpt4 book ai didi

android - 跟随 selectQuery 有什么问题吗?

转载 作者:行者123 更新时间:2023-11-29 02:00:07 27 4
gpt4 key购买 nike

int getIdForSong(Song song){

String selectQuery = "SELECT id FROM " + TABLE_SONG + " WHERE " + SONG_TITLE + "=" + song.getSongTitle() + " AND " + ARTIST_NAME + "=" + song.getArtistName();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
int id = Integer.parseInt(cursor.getString(0));
return id;
}

我在“=”附近遇到异常。任何人?

最佳答案

将 selectQuery 值更改为:

"SELECT id FROM " + TABLE_SONG + " WHERE " + SONG_TITLE + " = '" + song.getSongTitle() + "' AND  '" + ARTIST_NAME + "' = '" + song.getArtistName() + "'";

关于android - 跟随 selectQuery 有什么问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13099250/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com