Your SQL syntax is wrong. Don't user asterisk in your query.

Check this:
http://www.w3schools.com/sql/sql_delete.asp

On Monday, 28 March 2016 20:20:08 UTC+2, Elijah Smith wrote:
>
> I have this SQL statement that I want to execute:
>
> db.execSQL("DELETE * FROM " + TABLE_NAME + " WHERE " + DATE_TO_REMIND + "='" 
> + date + "'");
>
>
> Which, if I were running it today, translates to:
>
>
> "DELETE * FROM Vocabulary WHERE dateToReming ='2016/03/28'"
>
>
> This is throwing errors in the logcat though that point to the *, but I 
> can't understand what it is saying is faulty about this statement. Here is 
> the error:
>
> java.lang.RuntimeException: Unable to start activity 
>>> ComponentInfo{nuffsaidm8.me.activeenglish/nuffsaidm8.me.activeenglish.CheckVocabActivity}:
>>>  
>>> android.database.sqlite.SQLiteException: near "*": syntax error (code 1): , 
>>> while compiling: DELETE * FROM Vocabulary WHERE Date_To_Remind='2016/03/28'
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
>>
>>                                                                           
>>>        at android.app.ActivityThread.-wrap11(ActivityThread.java)
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
>>
>>                                                                           
>>>        at android.os.Handler.dispatchMessage(Handler.java:102)
>>
>>                                                                           
>>>        at android.os.Looper.loop(Looper.java:148)
>>
>>                                                                           
>>>        at android.app.ActivityThread.main(ActivityThread.java:5417)
>>
>>                                                                           
>>>        at java.lang.reflect.Method.invoke(Native Method)
>>
>>                                                                           
>>>        at 
>>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
>>
>>                                                                           
>>>        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
>>
>>                                                                           
>>>     Caused by: android.database.sqlite.SQLiteException: near "*": syntax 
>>> error (code 1): , while compiling: DELETE * FROM Vocabulary WHERE 
>>> Date_To_Remind='2016/03/28'
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native 
>>> Method)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:887)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:498)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674)
>>
>>                                                                           
>>>        at 
>>> android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605)
>>
>>                                                                           
>>>        at 
>>> nuffsaidm8.me.activeenglish.DBHelper.getWordsToReview(DBHelper.java:77)
>>
>>                                                                           
>>>        at 
>>> nuffsaidm8.me.activeenglish.CheckVocabActivity.onCreate(CheckVocabActivity.java:55)
>>
>>                                                                           
>>>        at android.app.Activity.performCreate(Activity.java:6251)
>>
>>                                                                           
>>>        at 
>>> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
>>
>>                                                                           
>>>        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
>>
>>                                                                           
>>>        at 
>>> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
>>
>>                                                                           
>>>        at android.os.Handler.dispatchMessage(Handler.java:102) 
>>
>>                                                                           
>>>        at android.os.Looper.loop(Looper.java:148) 
>>
>>                                                                           
>>>        at android.app.ActivityThread.main(ActivityThread.java:5417) 
>>
>>                                                                           
>>>        at java.lang.reflect.Method.invoke(Native Method) 
>>
>>                                                                           
>>>        at 
>>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
>>>  
>>
>>                                                                           
>>>        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/f41f82bf-5a26-42ba-8040-85d2da2a0f1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to