OK, got it. use this method: sql = 'select * from t where t between #%s# and #%s#' % (t1.strftime('%m/%d/%Y %I:%M:%S %p'), t1.strftime('%m/%d/%Y %I:%M:%S %p'))
ugly but works... 2011/3/14 机械唯物主义 : linjunhalida <linjunhal...@gmail.com>: > hello, is there any example for adodbapi? (more then testcase ship > with installer) > need to filter query result by time, but got error: > >>>> adodbapi.version > 'adodbapi v2.4.0' > > Background.mdb has this table t: > create table t (data string, t date); > > here is the code: > > import adodbapi, win32com > import adodbapi.ado_consts as adc > import datetime, time > > def main(): > filename = u"c:/workspace/Background.mdb" > connect_string = u'DRIVER={Microsoft Access Driver > (*.mdb)};DBQ=%s;' % filename > > conn = adodbapi.connect(connect_string) > cursor = conn.cursor() > > v = datetime.datetime(2010, 12, 27, 11, 40, 1) > > s = u'select t from t ' > cursor.execute(s) > > out = cursor.fetchall() > for row in out: print row > > s = u'select t from t where t between ? and ?' > cursor.execute(s, (v, v)) > > out = cursor.fetchall() > for row in out: print row > > > if __name__=="__main__": > main() > > here is the error: > > adodbapi.adodbapi.DataError: Converting Parameter p0: adDBTimeStamp, > None <- datetime.datetime(2010, 12, 27, 11, 40, 1) > > > thanks for your help! > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32