Problem : using ADO in ASP

toberstein at my-deja.com toberstein at my-deja.com
Sat Jan 29 15:45:35 EST 2000


I am using Python as an ActiveX Scripting Engine
in ASP/IIS and want to use ADO to connect to a
ODBC-compliant DB (in fact Access).

VBScript Code works - so there should be no setup
problem. Python in ASP Pages also works.

ASP Script :

<HTML><BODY>
<% @LANGUAGE=Python %>
<SCRIPT Language="VBScript" RUNAT=Server>
set db = Server.CreateObject("ADODB.Connection")
db.Open("DSN=MW")
set rs = Server.CreateObject("ADODB.RecordSet")
set rs = db.Execute("select * from water_a")
Response.Write( rs( "name" ) )
Response.Write( rs.Fields.Count )
db.Close
</SCRIPT>
<BR><BR>
<SCRIPT Language="Python" RUNAT=Server>
db = Server.CreateObject("ADODB.Connection")
db.Open("DSN=MW")
rs = db.Execute("select * from water_a")
#Response.Write( rs.Fields("name") )
#Response.Write( str(rs.Fields.Count) )
db.Close
</SCRIPT>
</BODY></HTML>


Output from the VBScript Code (OK) :

Balthasar-Neumann-Quelle33


Output from Python :


Python ActiveX Scripting Engine error '80020009'

Traceback (innermost last): File "<Script Block
>",
 line 7, in ? Response.Write( rs.Fields("name") )
AttributeError:
 'tuple' object has no attribute 'Fields'

/PythonASP_ADO.asp, line 17

Response.Write( rs.Fields("name") )


Python ActiveX Scripting Engine error '80020009'

Traceback (innermost last): File "<Script Block
>", line 8, in ? Response.Write(
str(rs.Fields.Count) ) AttributeError: 'tuple'
object has no attribute 'Fields'

/PythonASP_ADO.asp, line 18

Response.Write( str(rs.Fields.Count) )



Platform :

        NT40 Workstation SP4
        IIS4 (PWS Edition)
        Python 1.5.2 for Win32 Binary Distr.
        Pythonwin Build 125
        ADO 2.0, Access



Any useful Info? Many thanx in advance .. Tobias


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list