Phonegap上的Sqlite错误“附近”。“:语法错误”

时间:2012-07-24 08:11:00

标签: sqlite cordova

我正在使用cordova 1.9开发一个phonegap应用程序。
我在这个语句中有语法错误:

db.executeSql('UPDATE Reminder SET Reminder.reminderName ="'+ reminder_name + '", Reminder.reminderDescription = "' + description +'", Reminder.cellId='+ 1 +',  Reminder.timetableId ='+1+', Reminder.reminderDeadline ="' + deadline +'" WHERE Reminder.RminId = "'+reminderId+'" '); 

所以,我想知道我做错了什么?

2 个答案:

答案 0 :(得分:0)

看起来你的单引号和双引号错误而且凌乱 试试这个:

    db.executeSql("UPDATE Reminder SET Reminder.reminderName = "
            + reminder_name + ", Reminder.reminderDescription = "
            + description + ", Reminder.cellId = " + 1
            + ",  Reminder.timetableId = " + 1
            + ", Reminder.reminderDeadline = " + deadline
            + " WHERE Reminder.RminId = " + reminderId + " ");

答案 1 :(得分:0)

可能是你的1的问题。

如果你输入1,你应该把它放在变量中或保留引号:

db.executeSql('UPDATE Reminder SET Reminder.reminderName ="'+ reminder_name + '", Reminder.reminderDescription = "' + description +'", Reminder.cellId=1,  Reminder.timetableId =1, Reminder.reminderDeadline ="' + deadline +'" WHERE Reminder.RminId = "'+reminderId+'" ');

var cellID = 1;
var timetableID = 1;
db.executeSql('UPDATE Reminder SET Reminder.reminderName ="'+ reminder_name + '", Reminder.reminderDescription = "' + description +'", Reminder.cellId='+ cellID +',  Reminder.timetableId ='+timetableID+', Reminder.reminderDeadline ="' + deadline +'" WHERE Reminder.RminId = "'+reminderId+'" ');