Problem : using ADO in ASP

Steve Holden sholden at bellatlantic.net
Thu Feb 3 15:07:38 CET 2000


Aaarrrggghhh ...

toberstein at my-deja.com wrote:
> 
> 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.
> 
> [Original script and configuration details snipped]

Toby:

I did a little more digging.  Appears that the RecordSet
object in Python does have the methods that you would
expect to see, but I still haven't worked out how to
access the properties.

My ODBC source is Access 97, and I'm running on NT4
SP4 with IIS straight out of the Option Pack.

Here's a simplified script which (kind of) works by
using the GetRows() method to convert to a tuple (or
is it a list, I'm not yet sure - it should really be
mutable to allow the Update method to work):

<HTML><BODY>
<% @LANGUAGE=Python %>
<SCRIPT Language="Python" RUNAT=Server>
db = Server.CreateObject("ADODB.Connection")
db.Open("Billing")
rs = db.Execute("select * from project")
Response.Write(repr(rs))
RowList=rs[0].GetRows()
for Row in RowList:
	Response.Write("<p> %s\n" % repr(Row))
db.Close
</SCRIPT>
</BODY></HTML>

The output from this script is:

<HTML><BODY>

</BODY></HTML>


(<COMObject Execute>, -1)
<p> (L'WebCallback', L'TeamFinancial', L'USSInet')
<p> (L'Anything to be published under www.webcallback.com',
L'Investigation into the application to be used by USSI', L'Networking
of various kinds')
<p> (L'gphone', L'ussi', L'ussi')

I'm now having difficulty understanding why the GetRows method
seems to return COLUMNS!  Note also that the script output is
not "inline" as you would expect from its position in the code.

Don't know whether this will help ... it's caused me more of a
headache than I expected.

regards
 Steve



More information about the Python-list mailing list