SymbianError:[Errno -6]KErrArgument
Hi there, I'm using the following code to open (or create and open if not the database is not present) ad then add a row to an e32db.
The database creates fine, but the [CODE]db.execute(sql_add)[/CODE] line raises a [CODE]SymbianError:[Errno -6]KErrArgument[/CODE] error. Have I malformed the SQL statement?
[CODE]def db_write():
users_db = u'e:\\python\\ssusers.db'
sql_create = u'CREATE TABLE users (user VARCHAR, password VARCHAR)'
myuser = appuifw.query(u'user?', 'text')
mypwd = appuifw.query(u'password', 'text')
sql_add = u'INSERT INTO users (user, password) VALUES (\"' + myuser + '\", \"' + mypwd + '\")'
try:
db = e32db.Dbms()
db.open(users_db)
except:
db.create(users_db)
db.open(users_db)
db.execute(sql_create)
db.execute(sql_add)
db.close()[/CODE]
Re: SymbianError:[Errno -6]KErrArgument
hello fearoffours
basically KErrArguement is bad request error, and the only thing i can help you is to advice you to go through this [URL="http://wiki.forum.nokia.com/index.php/Database_in_PyS60"]link[/URL].
Regards
Gaba88
Re: SymbianError:[Errno -6]KErrArgument
Many thanks Gaba88, I have already looked at that article. It doesn't have any info on pulling specific rows out of the database in either e32db or e32dbm though, and nothing about KErrArgument
Re: SymbianError:[Errno -6]KErrArgument
Try to replace:
sql_add = u'INSERT INTO users (user, password) VALUES (\"' + myuser + '\", \"' + mypwd + '\")'
with:
sql_add = u"INSERT INTO users (user, password) VALUES ('%s','%s')"%(myuser,mypwd)