Closed GoogleCodeExporter closed 9 years ago
This is actually a general Python issue, not pyodbc, but I can help. You must
indent code that is "in" a for loop.
First, try saving the code to a file instead of using the interactive batch
session,
at least while you get used to it.
Second indent like this:
conn =
pyodbc.connect
("DRIVER=FreeTDS};SERVER=defekas62;UID=emuser;PWD=temporal;DATABASE=em620")
cursor = conn.cursor()
for row in cursor.execute("select USERNAME from JOBACTIONS"):
print row.USERNAME
Also, if your database is case-sensitive, you can use pyodbc.lowercase to force
all
returned column names to lower case. You would then use row.username instead
of
row.USERNAME.
Original comment by mkleehammer
on 5 Sep 2009 at 4:50
Original comment by mkleehammer
on 21 Nov 2010 at 4:43
Original issue reported on code.google.com by
davidtuti
on 27 Aug 2009 at 8:21