Trouble with SQLite and update

This is the place for queries that don't fit in any of the other categories.

Trouble with SQLite and update

Postby mickpc » Thu Jul 31, 2014 5:25 am

I have the following code:

Code: Select all

import sqlite3

conn = sqlite3.connect('data.db')
print "Opened database successfully";

conn.execute("UPDATE NUMDATA set VALUE = 3.0 where ID=2")
print "Total number of rows updated :", conn.total_changes

cursor = conn.execute("SELECT id, time, value  from NUMDATA")
for row in cursor:
   print "ID = ", row[0]
   print "TIME = ", row[1]
   print "VALUE = ", row[2], "\n"

print "Operation done successfully";


Now it says it updates the database, and displays the change. But when I query it (from a seperate script), it shows no change.


Last edited by Yoriz on Thu Jul 31, 2014 5:43 am, edited 1 time in total.
Reason: First post lock.
Posts: 1
Joined: Thu Jul 31, 2014 5:22 am

Re: Trouble with SQLite and update

Postby Yoriz » Thu Jul 31, 2014 5:43 am

Welcome to the forum, Please read the new users read this link in my signature.
Due to the reasons discussed here we will be moving to on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 7 guests