I want to delete some records from my database tables, for example table A and table B. Both table A and table B has a column name 'sycn_status' i want to delete only those records where the value of 'sync_status'is 'C'. For this purpose i wrote the following method but i'm getting the exception.
public void RemoveSyncData(){
DBHelper = new DatabaseHelper(context);
//db = DBHelper.getWritableDatabase();
db.execSQL("DELETE FROM "+ DATABASE_TABLE_DAILY_ATTENDANCE +" WHERE KEY_ATTENDANCE_SYN_STATUS ='C'");
db.close();
here i'm only checking for one table. and the second thing i want to count the deleting records so that users should know how much data is deleted.
Logcat errors
06-29 05:02:55.845: E/AndroidRuntime(1594): FATAL EXCEPTION: main
06-29 05:02:55.845: E/AndroidRuntime(1594): android.database.sqlite.SQLiteException: no such column: KEY_ATTENDANCE_SYN_STATUS (code 1): , while compiling: DELETE FROM dailyattendance WHERE KEY_ATTENDANCE_SYN_STATUS ='C'
06-29 05:02:55.845: E/AndroidRuntime(1594): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
06-29 05:02:55.845: E/AndroidRuntime(1594): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
06-29 05:02:55.845: E/AndroidRuntime(1594): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
Aucun commentaire:
Enregistrer un commentaire