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

2005-01-24 Thread nightmarch
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 "", line 1, in ?
  File "C:\Python24\Lib\site-packages\adodbapi\adodbapi.py", line 711,
in nextset
rsTuple=self.rs.NextRecordset()
  File "", 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
-- 
http://mail.python.org/mailman/listinfo/python-list


I want update one record using ADO,but I can't ,why?

2005-01-24 Thread nightmarch
I want update one record ,but I can't ,why?

code like following:

##-
import win32com.client as wc

def main():
conn = wc.Dispatch(r'ADODB.Connection')
rs = wc.Dispatch(r'ADODB.Recordset')
connStr = "Provider=MSDAORA.1;Password=jmpower;User
ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True"
tblName = r'wjtmp'

conn.Open(connStr )

rs.Open( tblName, conn, wc.constants.adOpenKeyset,
wc.constants.adLockOptimistic )

if rs.Supports( wc.constants.adUpdate ):
rs.Fields.Item(0).Value = 11
rs.Update()
else:
print "recordset can't update"

rs.Close()
conn.Close()

if __name__ == '__main__':
main()
##-


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


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

2005-01-24 Thread nightmarch
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
<[EMAIL PROTECTED]> wrote:
> On Mon, 24 Jan 2005 17:18:05 +0800, nightmarch <[EMAIL PROTECTED]>
> 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
> 
> --
>  > == <
>  >   [EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG <
>  >  [EMAIL PROTECTED] |   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
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I want update one record using ADO,but I can't ,why?

2005-01-25 Thread nightmarch
Sorry, I mean  this code line " rs.Supports( wc.constants.adUpdate ) "
got False result, So I can't update one record,i.e. I can't execute
this code "rs.Fields.Item(0).Value = 11".

And , if code is written like this:

##code-

I got error msg like following:

##errorMsg

On Tue, 25 Jan 2005 10:25:00 -0800, Robert Brewer <[EMAIL PROTECTED]> wrote:
> nightmarch wrote:
> > I want update one record ,but I can't ,why?
> >
> > code like following:
> >
> > ##-
> > import win32com.client as wc
> >
> > def main():
> > conn = wc.Dispatch(r'ADODB.Connection')
> > rs = wc.Dispatch(r'ADODB.Recordset')
> > connStr = "Provider=MSDAORA.1;Password=jmpower;User
> > ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True"
> > tblName = r'wjtmp'
> >
> > conn.Open(connStr )
> >
> > rs.Open( tblName, conn, wc.constants.adOpenKeyset,
> > wc.constants.adLockOptimistic )
> >
> > if rs.Supports( wc.constants.adUpdate ):
> > rs.Fields.Item(0).Value = 11
> > rs.Update()
> > else:
> > print "recordset can't update"
> >
> > rs.Close()
> > conn.Close()
> >
> > if __name__ == '__main__':
> > main()
> > ##-
> 
> You almost give us enough information to help out ,but you don't quite
> ,why?
> 
> What happens when you run the above? Is there any output? Error message?
> 
> Does your update affect the membership of the record in the keyset?
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/
> htm/mdconkeysetcursors.asp
> 
> Why are you using keysets at all?
> 
> 
> Robert Brewer
> MIS
> Amor Ministries
> [EMAIL PROTECTED]
>
-- 
http://mail.python.org/mailman/listinfo/python-list