_variant_t

E

Eric Kaplan

Why I got error for following code:
vtValue == VT_NULL

1>d:\trash4\database\database.cpp(156) : error C2593: 'operator ==' is
ambiguous

======================
bool Table::Get(char* FieldName,int& FieldValue){

_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
if (vtValue == VT_NULL ){
FieldValue = 0;
} else {
FieldValue=vtValue.date;
}

}
 
G

Giovanni Dicanio

Eric Kaplan said:
Why I got error for following code:
vtValue == VT_NULL

1>d:\trash4\database\database.cpp(156) : error C2593: 'operator ==' is
ambiguous

======================
bool Table::Get(char* FieldName,int& FieldValue){

_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
if (vtValue == VT_NULL ){

You may correct your code like this:

if ( vtValue.vt == VT_NULL )
...

_variant_t derives from VARIANT (i.e.: from struct tagVARIANT), so you can
access the 'VARTYPE vt' field using dot notation (.vt), and compare its
value with VT_NULL.

Giovanni
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top