Storing date/time value on SQL server with milliseconds resolution using vc++ and ado 2.0 
Author Message
 Storing date/time value on SQL server with milliseconds resolution using vc++ and ado 2.0

I am using ADO 2.0 with VC++ 5.0
My problem is that I need a way to store a date/time value in a SQL Server
6.5 database having a resolution of milliseconds.

I am using variants to send a date value to the database.
I think the milliseconds are lost using the following conversion functions.
So I tested the reverse function ( VariantTimeToSystemTime()). And Surely
milliseconds value was missing.

Can anyone suggest me another approach to solve my problem. I am still
inclined to use ADO objects.

SYSTEMTIME asys, bsys;
double d;
CTime t = CTime::GetCurrentTime();

        asys.wYear = t.GetYear();
        asys.wMonth = t.GetMonth();
        asys.wDayOfWeek = t.GetDayOfWeek() - 1;
        asys.wDay = t.GetDay();
        asys.wHour = t.GetHour();
        asys.wMinute = t.GetMinute();
        asys.wSecond = t.GetSecond();
        asys.wMilliseconds = 300;

        SystemTimeToVariantTime( &asys , &d);

// converting the variant back  

        VariantTimeToSystemTime(d, &bsys);

// bsys had the milliseconds missing.

Fri, 25 May 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Date format with SQL Server and Vc++

2. Storing Date values WITHOUT the time(ODBC)

3. Invoking Stored Procedures of SQL Server from VC ++

4. globalization date & time sql server

5. Getting Sql database server date and time??

6. SQL-Server + Date/Time

7. Getting time in millisecond resolution

8. Store RTF in Sql Server DB Using COM Object

9. Executing stored procedure on sql server 2000 using c program

10. Calling a SQL Server 7 stored proc from VC++

11. date and time integer values using Turbo C 1.5

12. Millisecond accurate time values in Win98?


Powered by phpBB® Forum Software