I wish to remove the chosen record form my SQLite Database during my android application. However I can't get it done and becoming the exception while program runs.

Here's what I'm attempting to remove the specific Selected Record.

 public void deleteRecord(String datarecord)
   {
       this.db.delete(TABLE_NAME, "name="+datarecord , null);
   }

Which is things i am doing around the click event where I carry out the remove operation from the selected Record.

dh.deleteRecord(FavMusicList[position]);

dh may be the object of my DataHelper Class where I've produced the deleteRecord function.

I get the SQLite Exception for that Syntax Error. And So I guess I'm surely making mistake using the Syntax to remove the specific Selected Record but could not understand what exactly I must correct.

Can anybody help me within this?

Thanks, david

My Stack Trace:

12-22 14:39:37.892: ERROR/AndroidRuntime(676): FATAL EXCEPTION: main
12-22 14:39:37.892: ERROR/AndroidRuntime(676): android.database.sqlite.SQLiteException: near "very": syntax error: , while compiling: DELETE FROM table1 WHERE name=Iâm very drunk
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:36)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1589)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at com.android.soundmachine.DataHelper.deleteRecord(DataHelper.java:42)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at com.android.soundmachine.FavoritesListing$SoundMacHineAdapter$1$1.onClick(FavoritesListing.java:192)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.os.Looper.loop(Looper.java:123)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at java.lang.reflect.Method.invokeNative(Native Method)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at java.lang.reflect.Method.invoke(Method.java:521)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-22 14:39:37.892: ERROR/AndroidRuntime(676):     at dalvik.system.NativeStart.main(Native Method)

Remove FROM table1 WHERE title=Iâm very drunk

Space isn't permitted. You need to give quote, or double quote within the WHERE clause.

While using the string match in SQLite ensure that it stays within single Quote 'your match string'

For Integer or number quote not needed..

Remove FROM table1 WHERE title='Iâm very drunk'