向表中插入新项目完美无缺,但更新无效。
我正在使用以下语句来更新我的数据库。
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)
下次我读取我的数据库时,没有进行更改。
有什么想法吗?
最佳答案
好吧,我让它工作了..一些方法..
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];
在我从字符串对象周围移除 ' ' 之前,这没有用。
关于iphone - FMDB executeUpdate 不改变数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17787452/