×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    19

    cannot insert data to database

    hello everyone, im a newbie in pys60. i am trying to develop an application involving database using this code..


    db=e32db.Dbms()
    dbv=e32db.Db_view()
    try:
    db.open(dbname)
    except:
    db.create(dbname)
    db.open(dbname)
    try:
    db.execute(u"CREATE TABLE test_table (id counter, fname VARCHAR, lname VARCHAR, age INTEGER )")
    print "Table Created"
    except SymbianError:
    print "Error Creating table: "

    db.execute(u"INSERT INTO test_table VALUES (1,f[0][2],gend[f[1][2][1]],f[2][2])")
    print "Data Inserted"



    i am pretty sure that the data are correct since i printed them on screen...i used a form in this app. i am just wondering y it wont work whenever i assign the value to a variable. it is actually working using this (1,"Jane","Female",1)....any idea?

  2. #2
    Regular Contributor
    Join Date
    May 2007
    Posts
    75

    Re: cannot insert data to database

    Quote Originally Posted by curiousthinker View Post
    db.execute(u"INSERT INTO test_table VALUES (1,f[0][2],gend[f[1][2][1]],f[2][2])")
    Maybe I'm wrong, but do you mean something like this?

    db.execute(u'INSERT INTO test_table VALUES (%d, "%s", "%s", %d)'%(1,f[0][2],gend[f[1][2][1]],f[2][2]))

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    19

    Re: cannot insert data to database

    Quote Originally Posted by mwibbels View Post
    Maybe I'm wrong, but do you mean something like this?

    db.execute(u'INSERT INTO test_table VALUES (%d, "%s", "%s", %d)'%(1,f[0][2],gend[f[1][2][1]],f[2][2]))
    hello, thanks for the reply..i tried it but still i cant insert data to it. ...any idea?

Similar Threads

  1. Replies: 0
    Last Post: 2008-05-19, 06:42
  2. Problem occur in exit(app crash) after insert data in listbox and save it???
    By chandantheracer in forum Symbian User Interface
    Replies: 8
    Last Post: 2007-05-17, 08:40
  3. Can't insert data in my database
    By jensesaat in forum Symbian
    Replies: 2
    Last Post: 2006-11-09, 10:51
  4. problems displaying video
    By gorsken in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2006-06-21, 17:18
  5. Link the data from the database
    By soonbee in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-05-14, 14:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×