Using Python 3.8.6 & SQL Server Express
cursor.execute("SELECT Output FROM Chat WHERE Input ='"+talk+"';")
for row in cursor:
if row[0] != None:
print(row[0])
break
else:
print("There is no response")
break
- If there is a SQL record the output prints fine
- If there is no SQL record then nothing prints
I would like the program to print "There is no response" if no record is found in SQL Server.