I am trying to run a SQL query to delete an item from a database. I have created a memory tag as type Integer. When I run the query I get an error that it failed to convert nvarchar to int. The memory tag is int and the column in the database is int. What am I doing wrong?
Script looks like this:
boxnum = “BoxNumForRemoval”
If boxnum is not None:
confirm = system.gui.confirm(“Are you sure to remove box %s ?” % boxnum, “Remove Box”)
if confirm:
server = “SQLServer_New”
txID = system.db.beginTransaction(server)
query = "DELETE FROM BoxLabelData WHERE BoxNumber >= ?"
args = [boxnum]
system.db.runPrepUpdate (query, args, server, tx = txID)
system.db.commitTransaction(txID)
system.db.closeTransaction(txID)
else:
system.gui.messageBox("No Box Selected", "Invalid Selection")