user1480067
user1480067

Reputation: 43

Getting no such column in the table

get an exception no such column but actually column data is present in the database am unable to catch that exception can any one help me

07-13 09:17:41.720: E/SQLiteLog(16717): (1) near "Yongming": syntax error
07-13 09:17:41.720: D/AndroidRuntime(16717): Shutting down VM
07-13 09:17:41.730: W/dalvikvm(16717): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
07-13 09:17:41.750: E/AndroidRuntime(16717): FATAL EXCEPTION: main
07-13 09:17:41.750: E/AndroidRuntime(16717): android.database.sqlite.SQLiteException: near "Yongming": syntax error (code 1): , while compiling: DELETE FROM Exhibitors_Bookmark_table WHERE Exhibitor_data=Shanghai Yongming Electronics Co.,LTD.
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1491)
07-13 09:17:41.750: E/AndroidRuntime(16717):    at datahandler.FavoratesDB.delete_exhibitor_name(FavoratesDB.java:156)

Upvotes: 0

Views: 71

Answers (1)

stinepike
stinepike

Reputation: 54672

in sqlite for where clause you need to use apostrophe around the search string. So your query should look like

DELETE FROM Exhibitors_Bookmark_table WHERE Exhibitor_data='Shanghai Yongming Electronics Co.,LTD.'

may be this is the reason of not getting.

Upvotes: 2

Related Questions