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,YESN O }
how would i achive like this ?
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,YESN
how would i achive like this ?
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;
ASKER
CAdoFieldInfo afi = { "fieldname",adchar,20,YESN O, 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,YESN O, 42, TRUE, TRUE, MyOrder;
"fieldname2",adchar,20,YES NO, 42, TRUE, TRUE, MyOrder;
"fieldname3",adchar,20,YES NO, 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,YESN
"fieldname2",adchar,20,YES
"fieldname3",adchar,20,YES
};
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}
};
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you very much for your help have a good week end
Open in new window