0

I'v searched throughout this forum and couldn't find an answer.

cur.execute("UPDATE lastran SET job_date=newtimedate WHERE job_name=usrjobname")

Why is my code now working?

The two variables are newtimedate and usrjobname

4
  • is job_name a string/text type? what error do you get? Commented Aug 7, 2017 at 15:52
  • 2
    what do you expect with "WHERE job_name=job_name"? Commented Aug 7, 2017 at 15:52
  • Updated post. The parameter is a variable. Commented Aug 7, 2017 at 15:56
  • What is the error you are getting? Commented Aug 7, 2017 at 15:57

1 Answer 1

1

I don't know Python, but it seems you're passing your variables as literals... a little Googling tells me this should be it?

cur.execute("UPDATE lastran SET job_date=? WHERE job_name=?", (newtimedate, usrjobname))

See how this person does it: How to see the real SQL query in Python cursor.execute

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.