我正在使用SqliteManager在数据库中添加数据。
我必须用下面的查询更新一个表,但它不更新表数据。
SQLiteManager.sharedInstance().executeQuery("UPDATE Invoice SET is_void = '1',void_comment ='(txtComment.text)',void_date = '(currentDateTime)' WHERE invoice_id = '(inVoiceNumber)'")
有人能告诉我这个查询有什么问题,或者我如何检查数据是否更新?
表发票结构
CREATE TABLE [Invoice]
(
[is_void] INT,
[void_comment] NVARCHAR(500),
[void_date] NVARCHAR(50),
[invoice_id] BIGINT,
)
对于动态inVoiceNumber
,只需这样传递,无需添加单引号。
var inVoiceNumber = Int(arrSales[tags].valueForKey("invoice_id") as! String)
SQLiteManager.sharedInstance().executeQuery("UPDATE Invoice SET is_void = 1,void_comment ='(txtComment.text)',void_date = '(currentDateTime)' WHERE invoice_id = (inVoiceNumber)")