我尝试更新数据库表,这是我的代码:
public void updatefiletable(String filename, String v1, String v2){
AndroidOpenDbHelper androidOpenDbHelperObj = new AndroidOpenDbHelper(this);
SQLiteDatabase sqliteDatabase = androidOpenDbHelperObj.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(AndroidOpenDbHelper.COLLUMN_NAME_FILE_CLOUD, v1);
values.put(AndroidOpenDbHelper.COLLUMN_NAME_FILE_DATE_UPLOADING, v2);
sqliteDatabase.update(AndroidOpenDbHelper.TABLE_FILE, values, AndroidOpenDbHelper.COLUMN_NAME_FILE_NAME+"="+filename, null);
sqliteDatabase.close();
}
当我用 file_name 值 egal priv_priv_secondfile_2012-06-15.pdf 调用我的方法时,我在 logcat 中得到了它:
android.database.sqlite.SQLiteException: unrecognized token: "15.pdf": ,
while compiling: UPDATE file_table SET file_cloud_column=?,
file_date_upload_column=?
WHERE file_name_column=priv_priv_secondfile_2012-06-15.pdf
我该如何解决?