[python-win32] Another ADO question

Moore, Paul Paul.Moore@atosorigin.com
Wed, 25 Sep 2002 14:40:52 +0100


The ADO Recordset Field object seems to lose type information. No matter =
what type of value I select from the database, RS.Fields(x).Value always =
has unicode string type. Is this a limitation in ADO? Something not =
getting passed back correctly? I have used makepy...

It's not the end of the world for numbers (I can always convert back =
from strings using int() or float() - although float() could lose =
precision, I guess) but it's a real pain for dates. Why isn't the field =
coming back as a VARIANT or the appropriate type? Can I make it do so?

Sample code:

    # Set up c as an ADO connection
    rs =3D c.Execute("SELECT 1 FROM DUAL")
    print `rs.Fields(0).Value`  # Gives u'1' rather than 1...

Thanks,
Paul.