1.Join到SQL中的表
- IFeatureLayer pFeatureLayer = axMapControl1.Map.get_Layer(0) as IFeatureLayer;
- IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
- IWorkspaceFactory pWsFact;
- IWorkspace pWorkspace;
- pWsFact = new OLEDBWorkspaceFactoryClass();
- IPropertySet pPropertySet=new PropertySetClass();
- pPropertySet.SetProperty("CONNECTSTRING", "Provider=SQLOLEDB;server=.;database=test;User Id=sa;Password=123");
- pWorkspace = pWsFact.Open(pPropertySet, 0);
- IFeatureWorkspace pFeatWS = (IFeatureWorkspace)pWorkspace;
- ITable pOleTable = pFeatWS.OpenTable(inTable);
- IMemoryRelationshipClassFactory pMemRelFact = new MemoryRelationshipClassFactoryClass();
- IRelationshipClass pRelClass = pMemRelFact.Open("", pFeatureClass, "村", (IObjectClass)pOleTable, "cunWei", "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne);
- IDisplayRelationshipClass pDispRC=pFeatureLayer as IDisplayRelationshipClass;
- pDispRC.DisplayRelationshipClass(pRelClass, esriJoinType.esriLeftOuterJoin);
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。