|
-
March 11th, 2004, 06:59 PM
#1
Hi,what is the meaning and usage of COleVariant?
I program between VC and ACCESS. Use CListView to show a *.mdb content.
look this to get room_name by room_id in a table)
//============================================
m_strTableName = _T("room");
strSelect = _T("Select room_ID,room_name From [");
strSelect += m_strTableName;
strSelect += _T("]");
m_pRecordset->Open(dbOpenDynaset,strSelect);
while (!m_pRecordset->IsEOF()) {
COleVariant var;
var = m_pRecordset->GetFieldValue(0);
StuffDlg.m_uaRoom.Add(var.lVal);
var = m_pRecordset->GetFieldValue(1);
StuffDlg.m_saRoom.Add(CCrack::strVARIANT(var));
m_pRecordset->MoveNext();
}
//============================================
!! StuffDlg.m_saRoom is a CStringArray.
what is the meaning and usage of COleVariant.The explanation in MSDN is too abstract!!
who can give me a simple example?
-
March 11th, 2004, 11:02 PM
#2
COleVariant is a class that wraps the VARIANT type (VARIANT structure) used in Visual Basic and VBA used by Microsoft Office apps like Excel, Access, Word. It makes it easier - less coding, more safety. When a C++ app "talks" to an Office app thru Automation, the data type that the Office app understands is VARIANT.
Hope that is clearer.
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|