By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,050 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,050 IT Pros & Developers. It's quick & easy.

SQLite3 problems

P: 2
Expand|Select|Wrap|Line Numbers
  1. db = sqlite3.connect('mydb.db')
  2. f1l = []
  3. f1l = db.execute("SELECT f1 FROM t1").fetchall()
  4. for i in range(0,len(f1l)):
  5.     xmlfile = matchf1(f1l[i])
  6.     print xmlfile
  7.     postcount = 0
  8.     for node in xmlfile.getElementsByTagName("t1"):
  9.         c1 = node.getAttribute("c1")
  10.     if c1 != 0:
  11.         for node2 in xmlfile.getElementsByTagName("t2"):
  12.             y = node2.getAttribute("t")
  13.             x = f1l[i]
  14.             db.execute("UPDATE t1 SET f2='%s' WHERE f1='%s'"%(y,x))
  15.             print y + " added to" + f1l[i]
  16. db.commit()
  17. db.close()
Ends up with:
Traceback (most recent call last):
File "D:\sumthin.py", line 28, in <module>
db.execute("UPDATE t1 SET f2='%s' WHERE f1='%s'"%(y,x))
OperationalError: near "005": syntax error

The data base got the table "t1" and the fields "f1" and "f2".
In all rows "f1" is filled and "f2" is "none".

Any suggestions?
Apr 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: 2
Never mind. I r fix.
Apr 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.