I am a JR .NET developer and have only a couple hours of basic Python training. I have been tasked with updating an existing py application. In the code snippit below I have added the green to the existing function. I have 2 questions. Does there look like any potential errors with my added snippet? And now that the change is made how to I push this to the executable? I am definitely more concerned with saving it to the exe.

def additem(): results=msSQL.query("SELECT ID FROM TradePulse.dbo.chainauth WHERE ID='{0}';" .format(item_number_entry.get()+LocalDB.settings('chainid'))) ar = results[0] [color=#2ECC71]stmt= "SELECT DeletedItemV.Item FROM DeletedItemV LEFT OUTER JOIN ItemV ON (DeletedItemV.Item = ItemV.Item)WHERE ItemV.Item IS NULL"[/color] if len(ar) > 0: root = tk.Tk() root.withdraw() messagebox.showerror("Chain ID Error", 'Choose a different item number, the entered selected already exists.') [color=#27AE60] # if the item has been deleted and is not active in all warehouses do not allow to add if ar == stmt: root = tk.Tk() root.withdraw() messagebox.showerror("Item ID Error", 'Choose a different item number, the entered selected already has been cancelled.')[/color] if len(ar) == 0: chain=LocalDB.settings('chainid') item=item_number_entry.get() altcode=item_retail_entry.get() if altcode=='AltCode': altcode='' msSQL.queryExecute("INSERT TradePulse.dbo.chainauth (ITEM,CHIND,AltCode,ID) VALUES ({0},'{1}','{2}','{3}');" .format(item,chain,altcode,item+chain)) item_name_txt.set('Item#') item_retail_txt.set('AltCode') item_grid(itemQuery())