1

我正在使用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+'" '); 

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

4

2 回答 2

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 + " ");
于 2012-07-24T08:21:07.337 回答
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+'" ');
于 2012-07-24T21:38:08.393 回答