ADODB.RecordSet bummer ( was Re: Python and DB support (was: Re: Is Python Dead?))

Bjorn Pettersen BPettersen at NAREX.com
Tue Jul 3 19:38:15 EDT 2001


> From: Bill Bell [mailto:bill-bell at bill-bell.hamilton.on.ca]
> 
> [Martelli's address not included since many list members may 
> already know it.]
> 
> Alex Martelli wrote, in part:
> 
> > you CAN write rs.Fields("FieldName").Value ... [and] ... I believe
> > ADO (and much more so, COM:-) deserves a far better language than
> > Visual Basic... Python, for example!-). 
> 
> Yup, me too FWIW. So, as one of this list's most longstanding 
> newbies, I decided to give the combination a spin.
> 
> In VBA it's common to coin the cliche:
> 
> with myRecordSet
> 	.edit
> 	.fields('myField') = 42
> 	.update
> end with
> 
> Unfortunately,
> 
> >>> import win32com.client
> >>> rs = win32com.client.Dispatch("ADODB.RecordSet")
> >>> rs.ActiveConnection = "DSN=WebPASS"
> >>> rs.Open("[URLs]")
> >>> rs.Fields("myField") = 42
> Traceback (SyntaxError: can't assign to function call
> 
> Or, is this because I forgot my medication this morning?

Try

  rs.Fields("myField").Value = 42

-- bjorn




More information about the Python-list mailing list