rieh25 wrote:
> Hello, I would like to know how to list query results. I've found usefull
> information about insert/update queries...
>
> conn = odbc.odbc("test1_Data")
> cursor = conn.cursor()
> cursor.execute("INSERT INTO local_cmgenadm
> (Application,Run_Date,Run_DateYMD,status) values
> (\'rimDev2PrdMdbDistrictPermit\',\'%s\', \'20060731\' ,
> \'Good\')")%mytime
> cursor.close()
> conn.close() 
>   

There is no need to escape the quote marks.  You're inside double
quotes, so there is no issue with single quotes.  However, it's better
to let the database layer do the quoting:
    cursor.execute(
        "INSERT INTO local_cmgenadm
(Application,Run_Date,Run_DateYMD,status) "
        "VALUES (%s,%s,%s,%s)", ('rimDev2PrdMdbDistrictPermit', mytime,
'20060731', 'Good')
    )

> ...and now I need to know how to list the results of a select query
>   

    cursor.execute( "SELECT Application,Run_Date FROM local_cmgenadm
WHERE status='Good'")
    for row in cursor.fetchall():
        print row[0], row[1]

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to