I have noticed a very strange effect that DirectX has on ODBC data storage.
Storing a DateTime object in a database is normally not a problem, but once a
Direct3D device is created the stored times only have a 5 minute resolution!
A few steps are required to reproduce the problem. First create a Microsoft
Access ODBC data source. Connect to it in the following way:
OdbcConnection connection = new OdbcConnection( "DSN=TestDB" );
connection.Open();
Add a table with a single DateTime column:
OdbcCommand cmd = new OdbcCommand( "CREATE TABLE TestData ( Stamp DATETIME
)", connection );
cmd.ExecuteNonQuery();
Insert the current time:
OdbcCommand cmd = new OdbcCommand( "INSERT INTO TestData(Stamp) VALUES (?)",
connection );
cmd.Parameters.Add( new OdbcParameter( "Stamp", OdbcType.DateTime ) );
cmd.Parameters["Stamp"].Value = DateTime.Now;
cmd.ExecuteNonQuery();
So far everything works as expected. Now create a Direct3D device:
PresentParameters para = new PresentParameters();
para.Windowed = true;
para.SwapEffect = SwapEffect.Discard;
Device dev = new Device( 0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, para );
Insert a new date/time in the database and you will notice that the stored
time is no longer correct.
Does anyone have a clue about what is going on?
For the record: I'm using Framework 1.1 and DirectX 9.0c.
|