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

Discussion in 'Python' started by nightmarch, Jan 26, 2005.

  1. nightmarch

    nightmarch Guest

    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-------------------------
    conn.Open(connStr )
    rs.Open( tblName, conn, wc.constants.adOpenKeyset,
    wc.constants.adLockOptimistic )

    rs.Fields.Item(0).Value = 11
    s.Update()
    ##>code-------------------------

    I got error msg like following:

    ##<errorMsg----------------------------
    self._oleobj_.Invoke(*(args + (value,) + defArgs))
    com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3',
    (0, 'ADODB.Field', 'Current Recordset does not support updating. This
    may be a limitation of the provider, or of the selected locktype.',
    'C:\\WINNT\\HELP\\ADO210.CHM', 0, -2146825037), None)
    ##>errorMsg----------------------------

    On Tue, 25 Jan 2005 10:25:00 -0800, Robert Brewer <> 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
    >
    >
    nightmarch, Jan 26, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nita
    Replies:
    1
    Views:
    843
    Saravana
    Nov 20, 2004
  2. nightmarch
    Replies:
    0
    Views:
    339
    nightmarch
    Jan 25, 2005
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,655
    Smokey Grindel
    Dec 2, 2006
  4. Jimmy Tran
    Replies:
    1
    Views:
    222
    Dan Brussee
    Oct 3, 2003
  5. Guest
    Replies:
    1
    Views:
    231
    Alex G
    Jan 9, 2004
Loading...

Share This Page