variable hell
Nx
nomail at nomail.com
Thu Aug 25 10:43:04 EDT 2005
Thanks for the many replies
here is an example for what it will be used for , in this case
fixed at 31 fieldvalues:
inputvalues=(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,
s26,s27,s28,s29,s30,s31)
MYINSERTSELECT = "INSERT INTO
ADDRESS(ALIAS,COMPANY,ADDRESSLI1,ADDRESSLI2,ADDRESSCO,TOWN,ZIP,COUNTRY,TEL1,TEL2,FAX,EMAIL,INTERNET,PERSON1,TITLE1,RES1,PERSON2,TITLE2,RES2,PERSON3,TITLE3,RES3,PERSON4,TITLE4,RES4,PERSON5,TITLE5,RES5,PRODALIAS,PAGER,TLX,ADDMEMO)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
con1.commit()
cur = con1.cursor()
try :
cur.execute(MYINSERTSELECT,inputvalues)
con1.commit()
print 'Inserted 1 record'
except IOError, (errno, strerror):
print "I/O error(%s): %s" % (errno, strerror)
except ValueError:
print "Could not convert data to an integer."
except:
print "Unexpected error:", sys.exc_info()[0]
raise
I am sure there is an easier way, but I have not found it yet.
Nx
More information about the Python-list
mailing list