What error are you getting, at what point in the code?
What database?
As a guess, is serial number a string or some number format? If it’s a number, the fact that you’re using it as a string is an issue. If serial numbers are in fact strings, the only other thing that jumps out is whether your DateTime field allows NULL. Side note: DateTime is a reserved word in MySQL, but not Sql Server or PostgreSQL.
Syntax note: parentheses will make a tuple only when at least one comma is present, and a tuple is acceptable as an arg list for runPrepUpdate(). For a tuple of just one element, use this:
else:
print “none”
“”""
And I get this error
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO SerialTracking (SerialNumber) VALUES (?)
In all of this I have also tried using system.db.runUpdateQuery, but still get errors.
You have to chose one of the methods. Pturmel and I gave two different approaches. I’m not sure mine was correct for the way you had scripted your arg variable.
You followed both JGJohnson’s suggestion and my suggestion. They were alternatives. What you have now is a string inside a tuple inside a list. You need a string inside either a tuple or a list.
I get a different error message
java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value ‘Database’ into type: class [Ljava.lang.Object;