Hi ...
I am trying to get Milliseconds from a SQL Database using ADO. The code below will return 0 for the wMilliseconds.
Any comments / solutions.
Thanks,
Chris
Code:// Some code is removed for clarity _variant_t vTemp; COleDateTime codtUpdateDateTime; // Define ADO connection pointers _ConnectionPtr pConnection = NULL; _RecordsetPtr pRecordset = NULL; try { // When we open the application we will open the ADO connection pConnection.CreateInstance(__uuidof(Connection)); // Open the ado connection pConnection->Open(bstrConnect,"","",adConnectUnspecified); // Select all the records csSQL = "SELECT * FROM dbo.MacgowanTest00"; // Create an instance of the database pRecordset.CreateInstance(__uuidof(Recordset)); // This is required to support the Sort Property pRecordset->CursorLocation = adUseClient; // Open the recordset pRecordset->Open(LPCTSTR(csSQL), pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText); while (pRecordset->GetadoEOF() == VARIANT_FALSE) { vTemp = pRecordset->Fields->GetItem(L"UpdateDateTime")->Value; // Try to get the millisonds here SYSTEMTIME sTime; codtUpdateDateTime = vTemp.date; codtUpdateDateTime.GetAsSystemTime(sTime); int ms=sTime.wMilliseconds; } } catch(...) { // handle error }




Reply With Quote