ASP and ADO AGAIN!

dsavitsk dsavitsk at e-coli.net
Thu Oct 3 18:19:34 CEST 2002


"Mark Ainsworth" <MarkA at sundance.com> wrote in message
news:mailman.1033655766.31394.python-list at python.org...

* * *

> objEquip = Server.CreateObject("ADODB.RecordSet")
> objEquip.Open("Select * from Equipment", objCalib)
> stDate = objEquip("dateinfo").value
>
> This gets the correct information, and it prints ok.
>
> If I now do:
>
> StString = "date %s" % stDate
> I get an empty string. Or
>
> StString = "date " + stDate
> I get an error message telling me it can't concenate string and time
> objects. But if stDate is a time object, why does
>
> IdValue = stDate.ctime()
> Tell me that ctime() isn't an method associated with the object because
> StDate = time
> LdValue = stDate.ctime()
> Does work!
>
> Anyway, what exactly is returned for a date/time object from the ADO
> libraries? I can do anything I want with strings and numbers. It's just
date
> and time values that are confusing me. I need to convert the info to find
> out which data value was stored before a predetermined date.
>
> Any help would be greatly appreciated.

have you tried Format?

>>> x = r.Fields.Item(1).Value
>>> x
<time object at 011720D8>
>>> x.Format()
'03/01/95 00:00:00'

Fo this and other ADO/Python topics, see
http://www.e-coli.net/pyado.html for basic info, and
http://www.e-coli.net/ado_examples.shtml for some common questions.

-d





More information about the Python-list mailing list