2011-09-28 95 views
0

这是错误:失败1(无法识别的令牌: “1295980589.jpg”)上0x2a6530

09-28 17:48:03.830: ERROR/Database(1485): Failure 1 (unrecognized token: "1295980589.jpg") on 0x2a6530 when preparing 'INSERT INTO bookmarks (id, title, image1File) VALUES (2014, 'Hilton Craigendarroch, '1295980589.jpg')'. 

这是代码:

this.db.execSQL("INSERT INTO " + CMSConstants.BOOKMARKS + " (" + CMSConstants.ID + ", " + CMSConstants.TITLE + ", " + CMSConstants.IMAGE1_FILE + ") VALUES (" + id + ", '" + title + ", '" + image + "')"); 

问题出在哪里? 希望有人能帮助我....

感谢名单 newone

回答

2

你错过了在标题关闭单引号。你认为图像名称的开头报价是标题的结束报价。试试这个:

this.db.execSQL("INSERT INTO " 
    + CMSConstants.BOOKMARKS 
    + " (" 
    + CMSConstants.ID 
    + ", " 
    + CMSConstants.TITLE 
    + ", " 
    + CMSConstants.IMAGE1_FILE 
    + ") VALUES (" 
    + id 
    + ", '" 
    + title 
    + "', '" // <-- Note ' before , 
    + image 
    + "')"); 
1
this.db.execSQL("INSERT INTO " + CMSConstants.BOOKMARKS + " (" + CMSConstants.ID + ", " + CMSConstants.TITLE + ", " + CMSConstants.IMAGE1_FILE + ") VALUES (" + id + ", '" + title + "', '" + image + "')"); 

试试这个,你忘了一个 “'”

1

你错过了关闭单引号的标题

试试这个

this.db.execSQL("INSERT INTO " + CMSConstants.BOOKMARKS + " (" + CMSConstants.ID + ", " + CMSConstants.TITLE + ", " + CMSConstants.IMAGE1_FILE + ") VALUES (" + id + ", '" + title + "', '" + image + "')"); 
相关问题