Problem : using ADO in ASP

Glen Starchman glen at electricorb.com
Sun Feb 13 07:18:05 EST 2000


not sure if this has anything to do with it, but GetRows() returns a VB
Variant of type Array.

Steve Holden wrote:

> Mark Hammond wrote:
> >
> > "Steve Holden" <sholden at bellatlantic.net> wrote in message
> > news:38998BC0.2760828B at bellatlantic.net...
> > > Aaarrrggghhh ...
> >
> > > (<COMObject Execute>, -1)
> >
> > It appears the "Execute" method returns 2 values - the recordset
> > object and some integer.  The integer is almost certainly due to one
> > of the params to Execute() being specified as a BYREF.
>
> Thanks.  The opacity of the COM object is bugging me, but I'll get
> there in time (I hope)...
>
> >
> > > <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.
> >
> > GetRows() returns a sequence of rows.  Each row contains columns.  In
> > the example above, you are looping over each row, and when you print
> > each row you get a tuple of objects - one for each column in the
> > recordset.
>
> I understand that's how it's SUPPOSED to work.  I just changed my data,
> so the queried table contains four rows and three columns.  And look
> what I now see:
>
> (<COMObject Execute>, -1)
> <p> (L'row3col1', L'row1col1', L'row2col1', L'row4col1')
> <p> (L'row3col2', L'row1col2', L'row2col2', L'row4col2')
> <p> (L'row3col3', L'row1col3', L'row3col3', L'row4col3')
>
> which is why I said GetRows appears to be returning COLUMNS: as I
> iterate over the result of GetRows, it would seem logical (captain)
> for the tuple to be the columns of that row.  But this is very
> definitely NOT what I am seeing.  Which makes me confused.
>
> >
> > Hope this helps...
> >
> > Mark.
>
> Well, any further light on this would be useful.  In case it matters,
> this is Python 1.5.2 on Windows NT4.0, service pack 4, and the ODBC
> data source is an Access 97 database.
>
> The code I used is copied below for completeness.
>
> regards
>  Steve
>
> <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>




More information about the Python-list mailing list