我收到android.database.sqlite.SQLiteException" SELECTamountFROMnilanjan_tableWHEREName&#34 ;:语法错误(代码1):
public Cursor getItemID(String name)
{
SQLiteDatabase db =this.getWritableDatabase();
String query = "SELECT" + COL_3 + "FROM" + TABLE_NAME +"WHERE" + COL_2 + " = '" + name + "'" ;
Cursor data = db.rawQuery(query,null);
return data;
}
答案 0 :(得分:0)
"SELECTamountFROMnilanjan_tableWHEREName"
是您作为查询执行的连接的结果。
您需要在关键字之间添加空格以创建有效的查询。:
"SELECT " + COL_3 + " FROM " + TABLE_NAME + " WHERE " + COL_2 + " = '" + name + "'" ;