The adodbapi package does not seem to handle datetime values appropriately.
import adodbapi print(adodbapi.version) cursor = adodbapi.connect(...) cursor.execute("CREATE TABLE #t (i INT, d DATETIME)") cursor.execute("INSERT INTO #t VALUES (42, GETDATE())") cursor.execute("SELECT * FROM #t") row = cursor.fetchone() print("d={}".format(row.d)) cursor.execute("INSERT INTO #t VALUES (?, ?)", (43, row.d)) cursor.execute("SELECT * FROM #t WHERE i = 43") row = cursor.fetchone() print("d={}".format(row.d)) When running under Python 2.7.13, the first print statement shows that the datetime value has been correctly retrieved, preserving the precision: d=2017-11-04 07:52:18.110000 but then when the second INSERT is executed an exception is raised: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'ADODB.Parameter', u'Application uses a value of the wrong type for the current operation.', u'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240652, -2146824867), None) So the package isn't allowing the script to use the same value it was given as a valid value for the d column by the package itself. When the script is run under Python 3.6.0, the exception is not raised, but that's only because the datetime precision has been discarded: d=2017-11-04 08:15:37 d=2017-11-04 08:15:37 I get the same behavior with adodbapi 2.6.0.6 (which I downloaded from the link which indicated (http://adodbapi.sourceforge.net/index.html) that this is the latest version) and on 2.6.0.7, which is what pip installed. I would like to help get both of these behaviors corrected (failure to store datetime values with microsecond precision in Python 2.x, as well as failure to preserve sub-second precision in retrieved values in Python 3.x). Before I dig in to do the work, though, I want to check in here to make sure patches are accepted so I don't spend time on something that's not wanted. Thanks! -- Bob Kline http://www.rksystems.com mailto:bkl...@rksystems.com _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32