当我尝试更新表时,应用程序崩溃并返回此致命错误:
06-09 08:02:34.026: I/Database(342): sqlite returned: error code = 1, msg = no such column: username
06-09 08:02:34.034: E/Database(342): Error updating valore=1234 using UPDATE parametri SET valore=? WHERE _parametro=username
06-09 08:02:34.034: D/AndroidRuntime(342): Shutting down VM
06-09 08:02:34.034: W/dalvikvm(342): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-09 08:02:34.054: E/AndroidRuntime(342): FATAL EXCEPTION: main
06-09 08:02:34.054: E/AndroidRuntime(342): android.database.sqlite.SQLiteException: no such column: username: , while compiling: UPDATE parametri SET valore=? WHERE _parametro=username
插入/更新的功能是这样的:
String strFilter = ParametriMetaData.PARAMETRO+"=" + parametro;
ContentValues args = new ContentValues();
args.put(ParametriMetaData.VALORE, valore);
System.out.println( strFilter );
mDb.update(ParametriMetaData.TAB_PARAMETRI, args, strFilter, null);
这是表的定义:
private static final String CREA_TAB_PARAMETRI = "CREATE TABLE IF NOT EXISTS " //codice sql di creazione della tabella
+ ParametriMetaData.TAB_PARAMETRI + " ("
+ ParametriMetaData.PARAMETRO+ " text primary key, "
+ ParametriMetaData.VALORE + " text not null);";
这是怎么回事?谢谢!