ADO getting DATETIME type

E

Eric Kaplan

I tried to get the DATETIME data type from SQL Server using ADO in
VC++.

The DATETIME value shown in SQLServer is
3/20/2008 2:00:00 AM

But when I look at the vtValue object in VC++ debugger it looks
something like:

tagVARIANT DATE = 39527.083333333336
vt 7 unsigned short
DATE 39527.083333333336 double

How can I modify the following code to get the correct DATEIMTE?


=========================
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.date;

=========================

bool Table::Get(char* FieldName,int& FieldValue)
{
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.date;
return 1;
}
 
S

SvenC

Hi Eric,
I tried to get the DATETIME data type from SQL Server using ADO in
VC++.

The DATETIME value shown in SQLServer is
3/20/2008 2:00:00 AM

But when I look at the vtValue object in VC++ debugger it looks
something like:

tagVARIANT DATE = 39527.083333333336
vt 7 unsigned short
DATE 39527.083333333336 double

VariantTimeToSystemTime should help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top