i use web.py 0.37
i meet the same question.
i solove it with this way:
edit db.py line no 660 ,change if not self.ctx.transactions: to if not 
self.ctx.transactions and self.dbname!="mssql": 
bingo
wish to help you 

在 2011年8月12日星期五UTC+8下午12时09分08秒,Andre Smit写道:
>
> The following code return no data but the same query using pymssql works 
> OK. I've included some of the the debug output - see anything?
> [code]
> import os, sys, web, json
> prog_dir = os.path.dirname(os.path.abspath(__file__))
> sys.path.append(prog_dir)
> urls = (
>     '/'      , 'Index',
>     '/prjs'  , 'Projects',
> )
> app = web.application(urls, globals())
> application = app.wsgifunc()
> templates_dir = os.path.join(prog_dir,'templates/')
> render = web.template.render(templates_dir)
> db = web.database(dbn='mssql',user='USER',pw='PW',db='TXCIT',host='myHOST')
> #as_dict=True
> web.config.debug = True
>
> class Index:
>     
>     def GET(self):
>         return render.index()
>
> class Projects:
>     
>     def GET(self):
>         dd = db.select('DB_HMA_PRJ')
>         return dd[0].CONT_ID[/code]
>
> <class 'pymssql.OperationalError'> at /prjs No data available. Python 
> /usr/lib/python2.7/site-packages/pymssql.py 
> in fetchone, line 236 Web GET 
> http://pavements2.ce.utexas.edu:8888/txcit/prjs 
>  Traceback (innermost first) 
>    
>    - /usr/lib/python2.7/site-packages/pymssql.py in fetchone 
>    1. raise OperationalError, "No data available." ...
>     ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
>    VariableValue self
>    <pymssql.pymssqlCursor object at 0x9bc6c0c>
>     - /usr/lib/python2.7/site-packages/web/db.py in iterwrapper 
>    1. row = db_cursor.fetchone() ...
>     ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
>    VariableValue db_cursor
>    <pymssql.pymssqlCursor object at 0x9bc6c0c>
>    names
>    ['CONT_ID', 'PRJ_NBR', 'LN_ITM_NBR', 'TX_HMA', 'BLAT', 'ELAT', 'BLON', 
>    'ELON']
>     - /usr/lib/python2.7/site-packages/web/utils.py in __getitem__ 
>    1. return self.i.next() ...
>     ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
>    VariableValue i
>    0
>    self
>    <web.utils.IterBetter instance at 0x9bc6d0c>
>    
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to webpy+unsubscr...@googlegroups.com.
To post to this group, send email to webpy@googlegroups.com.
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to