In Tkinter - having an input and an entry

markfernandes02 at googlemail.com markfernandes02 at googlemail.com
Sat Apr 5 05:56:15 EDT 2008


I need some advice,
I am creating a python program to communicate with an MS Access db in
python 2.4.
I can fetch records but cannot insert records.

def Insert(self, *row):
    global cursor, title, author, pubdate
    sqlInsert = "INSERT INTO Book_table"
    sqlInsert = sqlInsert + "(Bookname, BookAutor, "
    sqlInsert = sqlInsert + "Publicationdate) VALUES ('"
    sqlInsert = sqlInsert + title + "', '"
    sqlInsert = sqlInsert + author + "', "
    sqlInsert = sqlInsert + pubdate + ") "
    myconn = odbc.odbc('accessDatabase')
    cursor = myconn.cursor()
    cursor.execute(sqlInsert)
    myconn.commit()
    cursor.close()
    myconn.close()

The above code does not work.
Also with Tkinter, i want to have user input records into the db, i
cannot get what the user inputs into the entry to become a string
variable.

If you can help it would be most appreciated.
Thanks in advanced

Mark



More information about the Python-list mailing list