Hi,
i have used pymssql to connet to windows database but i want to be able iterate and only print out some specific fields.
here is what i did
conn=pymssql.connect(server,username,password,database)
cus=conn.cursor()
cus.execute("SELECT * FROM glbud ")
conn=pymssql.connect(server,username,password,database)
cus=conn.cursor()
cus.execute("SELECT * FROM glbud ")
for row in cus:
print(row)
this works perfect, but when i try to iterate through and only print out specific fields i got the error NameError: name 'budget_code' is not defined
for row in cus:
print(row.budget_code)
NameError: name 'budget_code' is not defined
for row in cus:
print(row.budget_code)
NameError: name 'budget_code' is not defined
the column name is budget_code, in mssql server 2008
any idea what i am doing wrong? please advise You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y6FWUjFwKw0D-6-8%2BggS6BP7uTFkz_aU45452f2sCpCYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment