吊死在这棵树上了.. 希望能详解
程序代码:
void CDlgLoadData::initTree(void) { if(!connectDatabase()) return; TV_INSERTSTRUCT tvInsert; HTREEITEM hParent, hItem; tvInsert.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvInsert.hInsertAfter=TVI_LAST; tvInsert.hParent=TVI_ROOT; tvInsert.item.pszText="数据库"; tvInsert.item.cchTextMax=strlen("数据库"); tvInsert.item.iImage=0; //. tvInsert.item.iSelectedImage=0; hParent=m_tree.InsertItem(&tvInsert); _variant_t vtVal; CString sVal; _RecordsetPtr rs; rs.CreateInstance(__uuidof(Recordset)); try { sVal=CString("select * from ")+CString("layer"); rs->Open(sVal.GetBuffer(0), //.数据库进行打开操作 x g_connGIS.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText); sVal.ReleaseBuffer(); tvInsert.hParent=hParent; tvInsert.item.iImage=1; tvInsert.item.iSelectedImage=1;