ASP and ADO AGAIN!

Mark Ainsworth MarkA at sundance.com
Thu Oct 3 10:34:40 EDT 2002


OK. So I may have not read all the right books, but I've read a lot of them.
Maybe just not the one with the right answer in?

I've been using python quite happily as an ASP scripting language for about
6 months now. We use it to pull data out of a Microsoft Access database the
is declared as an on ODBC source on the server. I can sort it, print it, in
fact do pretty much anything I want except...

One of the field values is declared as a date/time. This is returned and
printed on the HTML page correctly (apart from it will insist on the
American rather than UK format) Now I want to do some comparison
calculations everything starts to go wrong.

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.

Mark Ainsworth
Quality Manager
Sundance Multiprocessor Technology Ltd.
Chiltern House, Waterside, Chesham, Bucks HP5 1PS
Tel. +44 1494 793167 Fax. +44 1494 793168
MarkA at sundance.com http://www.sundance.com





More information about the Python-list mailing list