Hi,

Given an MS-Access table with a date type field with a value of:
12:00:00 AM - just"12:00:00 AM", there's nothing else in the field.

I want to print exactly what's in the field, ie. "12:00:00 AM". What I
get printed is:   12/30/0/ 00:00:00

I try:

import win32com.client
from win32.client import Dispatch

oConn=Dispatch('ADODB.Connection')
db = r'C:\mydb.mdb'
oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0; data Source="+db)
oRS = Dispatch('ADODB.RecordSet')
oRS.ActiveConnection =  oConn
c = oConn.OpenSchema(20)

while not c.EOF:
    tn = c.Fields.Item('Table_Name').Value
    oRS.Open(tn)
    (oRS, dt) = oConn.Execute('SELECT date_field FROM '+tn+' GROUP BY
    date_field')
    while not oRS.EOF:
        print oRS.Fields(dt).Value  # print here
         oRS.MoveNext()
    c.MoveNext()

oRS.Close()
oConn.Close()
# end

What's printed is:   12/30/0/ 00:00:00

How do I get exactly what's in the field? Note, there could be any legal
date time in the field - I'm trying in all cases to get exactly what's
in the field...or to put it another way, exactly what I see when I open
Access and look.

Thanks very much,

Lee G 
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to