需要用arcims的administrator建立一个featureservice服务,服务名为country
IIMSServiceDescription imsdsc = new IMSServiceNameClass();
imsdsc.URL = "http://su"; //su 机器名
imsdsc.Name = "country"; //服务名
imsdsc.ServiceType = acServiceType.acFeatureService; //featureservice服务 IWorkspaceFactory wf = new IMSWorkspaceFactoryClass();
IFeatureWorkspace w = wf.Open(imsdsc.ConnectionProperties, 0) as IFeatureWorkspace;
IFeatureClass Fcls = w.OpenFeatureClass("counties");
FeatureLayer featureLayer = new FeatureLayer();
featureLayer.FeatureClass = Fcls;
axMapControl1.AddLayer(featureLayer);
axMapControl1.Refresh();
IIMSServiceDescription imsdsc = new IMSServiceNameClass();
imsdsc.URL = "http://su"; //su 机器名
imsdsc.Name = "country"; //服务名
imsdsc.ServiceType = acServiceType.acFeatureService; //featureservice服务 IWorkspaceFactory wf = new IMSWorkspaceFactoryClass();
IFeatureWorkspace w = wf.Open(imsdsc.ConnectionProperties, 0) as IFeatureWorkspace;
IFeatureClass Fcls = w.OpenFeatureClass("counties");
FeatureLayer featureLayer = new FeatureLayer();
featureLayer.FeatureClass = Fcls;
axMapControl1.AddLayer(featureLayer);
axMapControl1.Refresh();