how to get a value from textCtrl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kennethEntera
    New Member
    • Jan 2008
    • 6

    how to get a value from textCtrl

    i use boa 6.6 and python 2.5 and pygreSQl

    i wander whats wrong with my codes

    def OnButton1Button (self, event):
    from pg import connect
    def pg_connect():
    return connect(dbname = "postgres", user = "postgres",
    host = "localhost" ,
    port = 5432, passwd = "postgres")

    db = pg_connect()
    db.query("""INS ERT INTO room VALUES(''textCt rl1.Value'')""" )

    i cant take the value from a textCtrl
    can someone help me??
  • Elias Alhanatis
    New Member
    • Aug 2007
    • 56

    #2
    Originally posted by kennethEntera
    i use boa 6.6 and python 2.5 and pygreSQl

    i wander whats wrong with my codes

    def OnButton1Button (self, event):
    from pg import connect
    def pg_connect():
    return connect(dbname = "postgres", user = "postgres",
    host = "localhost" ,
    port = 5432, passwd = "postgres")

    db = pg_connect()
    db.query("""INS ERT INTO room VALUES(''textCt rl1.Value'')""" )

    i cant take the value from a textCtrl
    can someone help me??
    Hi!

    I am not an expert , but i think you should change the last line to something like this:

    db.query("""INS ERT INTO room VALUE '%s' """ % textCtrl1.GetVa lue())

    Using 'String Formating' like this , will allow you to insert to the database the various entries you get on the text control.
    Hope i helped a little......!
    Elias

    Comment

    Working...