Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28830

Re: PYODBC Print Cursor Output Question

Date 2012-09-10 17:19 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: PYODBC Print Cursor Output Question
References <4a3619f2-721a-4aca-9a97-f90aaf6a1346@u15g2000yql.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.452.1347293956.27098.python-list@python.org> (permalink)

Show all headers | View raw


On 10/09/2012 15:55, james simpson wrote:
> I think there's a simple answer but displaying my ignorance here.
> I'm
> using Python 2.7.3 IDLW with pydoc 3x
>
> I think I've connected to my SQL Server 2005 and my SQL is good.
>
> How do I display the actual data returned from my fetch?  Been
> searching for several hours but no joy...
>
> Thanks. Jamie
>
> ===============================================
>>>> cursor.execute("select * from project")
>
> row = cursor.fetchone()
> if row:
>      print row
>
> <pyodbc.Cursor object at 0x0167D678>   I'd like to actually see SQL
> output here?)
>
>
Try this:

 >>> results = cursor.execute("select * from project")
 >>> row = results.fetchone()
 >>> print row

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

PYODBC Print Cursor Output Question james simpson <desolatechair@gmail.com> - 2012-09-10 07:55 -0700
  Re: PYODBC Print Cursor Output Question MRAB <python@mrabarnett.plus.com> - 2012-09-10 17:19 +0100

csiph-web