Link to home
Start Free TrialLog in
Avatar of hp746
hp746

asked on

fields define from struct in vc++ 6.0

hi,
I have struct like this
struct CAdoFieldInfo
{
      // The name of field
      char m_strName[30];
      // the field type
      short m_nType;
      // The field size
      long m_lSize;
            // the attributes of field
      long m_lAttributes;
      // the ordinal position of current field
      short m_nOrdinalPosition;
      //
      BOOL m_bRequired;  
      BOOL m_bAllowZeroLength;
      long m_lCollatingOrder;  
};

I want to define my fields like this

{ 'fieldname',adchar,20,YESNO    }

how would i achive like this ?
Avatar of jkr
jkr
Flag of Germany image

You could do that like
CAdoFieldInfo afi = { "fieldname",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder};

Open in new window

Or, alternatively, you can set the members individually:
CAdoFieldInfo afi;
 
strcpy(afi.m_strName,"fieldname");
afi.m_nType = addchar;
afi.m_lSize = 20;
afi.m_lAttributes = YESNO;
afi.m_nOrdinalPosition = 42;
afi.m_bRequired = TRUE;
afi.m_bAllowZero = TRUE;
afi.m_lCollatingOrder = MyOrder;

Open in new window

Avatar of hp746
hp746

ASKER

CAdoFieldInfo afi = { "fieldname",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder};
is afi holds only one fieldname or set of fields?
like i have 3 coulms in my table fname,lastname,stdno can i do like this
CAdoFieldInfo afi = { "fieldname",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder;
                                 "fieldname2",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder;
                                 "fieldname3",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder;

};
Fot the latter one, you need an array of structs, e.g.
CAdoFieldInfo afi[3] = 
{
  { "fieldname",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder},
  { "fieldname2",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder},
  { "fieldname3",adchar,20,YESNO, 42, TRUE, TRUE, MyOrder}
};

Open in new window

Avatar of hp746

ASKER

once i have my fileds can i use BEGIN_ADO_BINDING(Class)
   ADO_FIXED_LENGTH_ENTRY(...)
to bind .could you please let meknow how could i do this.since i am new to vc++ 6.0
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hp746

ASKER

thank you very much for your help have a good week end