mx.ODBC minor problem

Greg Corradini gregcorradini at gmail.com
Thu Apr 12 21:53:46 EDT 2007


Hello all,
In a script i just wrote, my code calls a function createTables(), which
checks for an existing table and then creates it, and then immediately calls
selectSQL(), which selects from a different table and inserts on the table I
just created (see below). 

However, I continue to get an Interface Error (see below) when i run it. And
yet, if I allow the code to call createTables() and then manually call
selectSQL() after a couple seconds, the thing works fine. In short, there's
no mismatch in the number of parameters. Why would this be? I've never
experienced this before. How can i restructure my code to resolve this
problem? 
---
CODE
---
def createTables():
    # Drop AddScript Table
    try:
        curse.execute('Drop table ' +countyname+'ADD_SCRIPT_TABLE')
        conn.commit
    except:
        pass
    # Create AddScript Table
    curse.execute('Create table ' +countyname+'ADD_SCRIPT_TABLE'+ ' (TISCODE
TEXT(12), STATUS TEXT(4))')
    conn.commit()

def selectSQL():
    sql = "Select TISCODE,STATUS from " +countyname+"0"+ " where STATUS =
'AS'"
    curse.execute(sql)
    a = curse.fetchall()
    curse.executemany('Insert into ' +countyname+'ADD_SCRIPT_TABLE'+ '
(TISCODE,STATUS) values (?,?)',x)
    conn.commit()
---
ERROR
---
InterfaceError: mismatch in number of parameters; expected 2, found none
-- 
View this message in context: http://www.nabble.com/mx.ODBC-minor-problem-tf3569303.html#a9971678
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list