By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

Why can't use cursor.nextset() in adodbapi package?

P: n/a
I want use crsr.nextset() , But I got errors like following:

connStr = "Provider=MSDAORA.1;Password=jmpower;User ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True" import adodbapi
conn= adodbapi.connect( connStr )
crsr = conn.cursor()
sql = "select * from wjtmp"
crsr.execute(sql)
rec = crsr.fetchone()
crsr.nextset()

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\adodbapi\adodbapi.py", line 711,
in nextset
rsTuple=self.rs.NextRecordset()
File "<COMObject Execute>", line 2, in NextRecordset
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py",
line 251, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags,
retType, argTypes) + args)
com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3',
(0, 'ADODB.Recordset', 'Current provider does not support returning
multiple recordsets from a single execution.',
'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825037), None)


Why?

thanks
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Mon, 24 Jan 2005 17:18:05 +0800, nightmarch <ni********@gmail.com>
declaimed the following in comp.lang.python:
sql = "select * from wjtmp"
crsr.execute(sql)
rec = crsr.fetchone()
crsr.nextset()
com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3',
(0, 'ADODB.Recordset', 'Current provider does not support returning
multiple recordsets from a single execution.',
'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825037), None)


Why?

Could it be because you don't have multiple recordsets in crsr?

You're executing a single select statement, retrieving the
/first/ record from the result, and then trying to get a totally
different result set.

Maybe you want the next record in the record set you already
have? crsr.fetchnext()?
thanks
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #2

P: n/a
Thank you Dennis!

You mean I should execute many select statement like this " rec =
crsr.fetchall() " ?
But the result is the same, still got the error like "... 'Current
provider does not support returning multiple recordsets from a single
execution.'..."
On Mon, 24 Jan 2005 17:00:39 GMT, Dennis Lee Bieber
<wl*****@ix.netcom.com> wrote:
On Mon, 24 Jan 2005 17:18:05 +0800, nightmarch <ni********@gmail.com>
declaimed the following in comp.lang.python:
>> sql = "select * from wjtmp"
>> crsr.execute(sql)
>> rec = crsr.fetchone()
>> crsr.nextset()

com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3',
(0, 'ADODB.Recordset', 'Current provider does not support returning
multiple recordsets from a single execution.',
'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825037), None)


Why?


Could it be because you don't have multiple recordsets in crsr?

You're executing a single select statement, retrieving the
/first/ record from the result, and then trying to get a totally
different result set.

Maybe you want the next record in the record set you already
have? crsr.fetchnext()?
thanks


--
> ================================================== ============ <
> wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wu******@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #3

P: n/a
On Tue, 25 Jan 2005 11:23:51 +0800, nightmarch <ni********@gmail.com>
declaimed the following in comp.lang.python:
Thank you Dennis!

You mean I should execute many select statement like this " rec =
crsr.fetchall() " ?
But the result is the same, still got the error like "... 'Current
provider does not support returning multiple recordsets from a single
execution.'..."
Multiple recordsets, as I understand it, implies one execute
that returns more than one "select" structure (I'm very weak on
paraphrasing this).

Your SELECT should be returning multiple /records/ in ONE
recordset. It is the multiple records you should be processing. What
follows is an excerpt from a program I have that updates a static web
page (no CGI/dynamic server available -- I have to update the database
locally, run a Python script to regenerate the web page, and upload the
web page).

I execute a SELECT, the process /all/ the returned records using
a loop on fetchall(). {TableRow() is a short function that writes the
HTML for a table data row}

# open database NOTE: NO ERROR CHECKING
myDB = MySQLdb.connect(host='localhost', user='bestiaria',
passwd='web-asst', db='bestiaria')
myC = myDB.cursor()

# get convention records occurring later than today
myC.execute("""select name, URL, banner, width, height, dates,
site, notes
from conventions
where sortdate > curdate()
order by sortdate""")

# write each to table
for aCon in myC.fetchall():
(name, URL, banner, width, height, dates, site, notes) =
aCon
TableRow(fnew, name, URL, banner, width, height, dates,
site, notes)

# repeat for convention records occurring BEFORE today
myC.execute("""select name, URL, banner, width, height, dates,
site, notes
from conventions
where sortdate <= curdate()
order by sortdate""")

# write each to table
for aCon in myC.fetchall():
(name, URL, banner, width, height, dates, site, notes) =
aCon
TableRow(fnew, name, URL, banner, width, height, dates,
site, notes)
Oh, if it means anything, that uses a DB-API compatible module,
not some M$ specific system...

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #4

P: n/a
nightmarch <ni********@gmail.com> wrote:
Thank you Dennis!

You mean I should execute many select statement like this " rec =
crsr.fetchall() " ?


No, you misunderstand. nextset() is used when you issue several SELECT
statements in a single request. The first fetchall() gets the results of
the first SELECT statement. To get the next one, you use nextset().

Your example only had one SELECT:
> >>> sql = "select * from wjtmp"
> >>> crsr.execute(sql)
> >>> rec = crsr.fetchone()
> >>> crsr.nextset()


If you are only issuing one SELECT, like most applications, then nextset()
serves no purpose. If you did something like this:

sql = "select * from wjtmp; select count(*) from wjtmp;"

That's when you need nextset(). Personally, I've never used it.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.