Iphone FMDB executeUpdate不更改数据库

Iphone FMDB executeUpdate不更改数据库,iphone,ios,sqlite,fmdb,Iphone,Ios,Sqlite,Fmdb,向表中插入新项效果很好,但是更新没有效果 我正在使用以下语句更新我的数据库 BOOL success = [fmDB executeUpdate:@"UPDATE activities SET type = ?, author = '?', time = '?', location = '?', node = '?', nodeID = ? WHERE itemid = ?", [NSNumber numberWithInt:i

向表中插入新项效果很好,但是更新没有效果

我正在使用以下语句更新我的数据库

BOOL success = [fmDB executeUpdate:@"UPDATE activities SET type = ?, author = '?', 
                time = '?', location = '?', node = '?', nodeID = ? 
                WHERE itemid = ?", [NSNumber numberWithInt:itemType], author, 
                time, location, node, [NSNumber numberWithInt:nodeID], 
                [NSNumber numberWithInt:itemID], nil];
所有未包装为NSNumber的内容都是NSString(所有内容都按预期注销)

当命令运行时,我收到0个错误(成功bool返回TRUE)

下一次我读取数据库时,还没有进行更改


有什么想法吗?

好吧,我开始工作了。。如何

 if([db open])
 {
    NSString *queryStr ;
    queryStr = [NSString stringWithFormat:@"Update activities SET type = ?, author = '?', 
            time = '?', location = '?', node = '?', nodeID = ? 
            WHERE itemid = ? ",[NSNumber numberWithInt:itemType], author, 
            time, location, node, [NSNumber numberWithInt:nodeID], 
            [NSNumber numberWithInt:itemID]];
    [db executeUpdate:queryStr];
    NSLog(@"UPDATE\n%@",queryStr);
  }
 BOOL success = [fmDB executeUpdateWithFormat:@"UPDATE activites 
   SET type = %@, node = %@, time = %@, location = %@, author = %@, 
   nodeID = %@ WHERE itemid = %@", [NSNumber numberWithInt:itemType], 
   node, time, location, author, [NSNumber numberWithInt:nodeID], 
   [NSNumber numberWithInt:itemID], nil];

直到我从字符串对象周围删除了“”之后,这才起作用。

我希望数据库不在应用程序包中,而是在某个可写的地方…数据库在设备上-/var/mobile/Applications/*/Documents/FeedItems.db,就像我说的,我可以插入到其中,只是不更新已经存在的项。跟踪执行似乎也正在注销在您提供的链接中被激发的正确语句解决方案是更新查询没有用逗号分隔,我的是您不能在[NSString stringWithFormat:]中使用“?”,如果您想这样做,您必须使用%@。这本质上与我正在做的没有什么不同,只是调用了executeUpdate两次,没有保存任何更改。