Article ID: 172405
Article Last Modified on 10/24/2003
170365 INFO: Visual Studio 97 Service Packs - What, Where, and Why
// The pre-3.5 GUIDs have been redefined with "30" added to the ID. // For example: // IID_IDAOIndex becomes IID30_IDAOIndex //This way both the 30 and 3.5 GUIDs can be used at once.
CString strFilename = _T("c:\\db1.mdb");
// Create a dao database
CDaoDatabase database;
database.Create(strFilename);
// Create "DEFAULT" table
CDaoTableDef tableDef(&database);
tableDef.Create(_T("DEFAULT"));
// Create a single field "IDENTIFIER"
CDaoFieldInfo fieldInfo;
fieldInfo.m_strName = _T("IDENTIFIER");
fieldInfo.m_nType = dbText;
fieldInfo.m_lSize = 255;
fieldInfo.m_lAttributes = 0;
fieldInfo.m_nOrdinalPosition = 0;
fieldInfo.m_bRequired = FALSE;
fieldInfo.m_bAllowZeroLength = FALSE;
fieldInfo.m_lCollatingOrder = 0;
tableDef.CreateField(fieldInfo);
// Create the primary key
CDaoIndexFieldInfo indexFieldInfo;
indexFieldInfo.m_strName = _T("IDENTIFIER");
indexFieldInfo.m_bDescending = FALSE;
CDaoIndexInfo indexInfo;
indexInfo.m_strName = _T("IDENTIFIER");
indexInfo.m_pFieldInfos = &indexFieldInfo;
indexInfo.m_nFields = 1;
indexInfo.m_bPrimary = TRUE;
indexInfo.m_bUnique = TRUE;
indexInfo.m_bClustered = FALSE;
indexInfo.m_bIgnoreNulls = FALSE;
indexInfo.m_bRequired = TRUE;
indexInfo.m_bForeign = TRUE;
indexInfo.m_lDistinctCount = 0;
tableDef.CreateIndex(indexInfo); // Generates exceptionKeywords: kbbug kbfix kbvs97sp2fix kbdatabase KB172405