nessuna pretesa...giusto una snippet
---------------------------------------------------------------------------
import sqlite3
import android
nome = ""
droid=android.Android()
# Connect to database file, create it if it does not exist
conn = sqlite3.connect('/sdcard/sqlitedemo.db')
# Get a cursor
cursor = conn.cursor()
# Create a table
cursor.execute("CREATE TABLE IF NOT EXISTS anagrafica (nome text)")
# Insert some data
while nome<>"exit":
nome=droid.dialogGetInput("","Il nome prego").result
sql_string = "INSERT INTO anagrafica VALUES ('"+str(nome)+"')"
print sql_string
cursor.execute(sql_string)
conn.commit()
# Read the data back out
cursor.execute("SELECT * from anagrafica")
for row in cursor:
print row
Nessun commento:
Posta un commento