-1

I am using SqliteManager to add data in database.

I have to update a table with the query below but it doesn't updating table data.

SQLiteManager.sharedInstance().executeQuery("UPDATE Invoice SET is_void = '1',void_comment ='\(txtComment.text)',void_date = '\(currentDateTime)' WHERE invoice_id = '\(inVoiceNumber)'")

Can someone please tell me what is wrong with this query or how can I check if the data is updated?

Structure of table Invoice

CREATE TABLE [Invoice]
(
   [is_void] INT,
   [void_comment] NVARCHAR(500),
   [void_date] NVARCHAR(50),
   [invoice_id] BIGINT,
)
Nirav D
  • 71,513
  • 12
  • 161
  • 183
Krutarth Patel
  • 3,407
  • 6
  • 27
  • 54

1 Answers1

3

For dynamic inVoiceNumber, Just pass like this no nee to add single quote.

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)")
Nirav D
  • 71,513
  • 12
  • 161
  • 183