Python and ADO 2.5?
Peter Immarco
android at micron.net
Sun Jun 11 09:48:47 EDT 2000
Eduard,
Thanks, good info. The two books I have due to show up tomorrow are:
Python Essential Reference
Python Programming on Win 32
What language was your main staple before Python and how do you like Python
relative to it?
Peter.
Eduard Hiti wrote:
> I used ADO 2.5 in my last Python project, and had no problems at all. Most
> of the time, ADO access in VB translates almost directly to python syntax.
> Features of ADO I used with no problem include parameterized commands, batch
> updating and client side cursors.
>
> One thing to keep in mind is the way pythoncom handles out-parameters of
> method calls: These values are returned as part of the method result, e.g
> the Execute method of the Connection object returns a tuple consisting of an
> RecordSet object and the RecordsAffected value (see MSDN):
>
> recordset, affected = db_connect.Execute("select * from ...")
>
> In VB you would only get the recordset returned and RecordsAffected would
> get stuffed in a reference parameter of the call.
>
> Another point is handling of date values: They are returned as objects with
> type pywintypes.TimeType. The documentation for this type is very terse, and
> I had to dig into the pythoncom demos to find their interface: One useful
> method is Format(<formatstring>), which will return a string from TimeType:
>
> import pywintypes
> if type(x) == pywintypes.TimeType:
> return x.Format("%d.%m.%Y")
>
> For more information on COM and Python I recommend Mark Hammond's "Python
> Programming on Win32" (which covers almost the entire COM body, albeit
> sometimes not too deeply: "Advanced Python Programming..." ?), which has a
> chapter on database programming.
>
> Good luck,
>
> Eduard
More information about the Python-list
mailing list