I want to generate a service order number, I have the code, but I do want it to query the last number of the service order that was generated in the database.
Follow the code:
def rangeOrdemServ(self):
db = self.conexaoBanco()
cursor = db.cursor()
cursor.execute("select ordem_serv_num from ordem_serv where id = LAST_INSERT_ID()")
dadosOrdemServ = cursor.fetchall()
db.commit()
global rec
pStart = dadosOrdemServ
pInterval = +1
if (rec == 0):
dado = pStart + pInterval
self.entrOrdServ.insert(END,dado)
else:
rec += pInterval
return rec
The error:
Traceback (most recent call last):
File "E:/CharIp ServerFTP_1.1/CharIP_1.1.7/Ordem_Servicos.py", line 152, in <module>
sis(root)
File "E:/CharIp ServerFTP_1.1/CharIP_1.1.7/Ordem_Servicos.py", line 21, in __init__
self.telaOrdServ()
File "E:/CharIp ServerFTP_1.1/CharIP_1.1.7/Ordem_Servicos.py", line 108, in telaOrdServ
self.rangeOrdemServ()
File "E:/CharIp ServerFTP_1.1/CharIP_1.1.7/Ordem_Servicos.py", line 119, in rangeOrdemServ
dado = pStart + pInterval
TypeError: can only concatenate tuple (not "int") to tuple