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

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

  1. nightmarch

    nightmarch Guest

    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!
    nightmarch, Jan 25, 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:
    856
    Saravana
    Nov 20, 2004
  2. nightmarch
    Replies:
    0
    Views:
    378
    nightmarch
    Jan 26, 2005
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,762
    Smokey Grindel
    Dec 2, 2006
  4. Jimmy Tran
    Replies:
    1
    Views:
    226
    Dan Brussee
    Oct 3, 2003
  5. Guest
    Replies:
    1
    Views:
    243
    Alex G
    Jan 9, 2004
Loading...

Share This Page