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

Robert Brewer fumanchu at amor.org
Tue Jan 25 13:25:00 EST 2005


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
fumanchu at amor.org



More information about the Python-list mailing list