Hello,
I am trying to run one of the examples on adding Dynamic Data. I have the following code:
Dim filePath As String = "C:\"
Dim fileName As String = "us_lakes.shp"
' Get a reference to the shapefile directory as an ArcObjects FeatureWorkspace
Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = CType(serverContext.CreateObject("esriDataSourcesFile.ShapefileWorkspaceFactory"), ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)
Dim workspace As ESRI.ArcGIS.Geodatabase.IWorkspace = workspaceFactory.OpenFromFile(filePath, 0) Dim featureWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = CType(workspace, ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)
' Get a reference to the shapefile as a GeoFeatureLayer
Dim aoFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = CType(serverContext.CreateObject("esriCarto.FeatureLayer"), ESRI.ArcGIS.Carto.IFeatureLayer)
aoFeatureLayer.FeatureClass = featureWorkspace.OpenFeatureClass(fileName)
I am getting an error on the line in red. I know the file exists on the C:\ and it is one of the files supplied by ESRI when installing. I don't know what else I need to do. Please let me know.
Lastly, if my filepath is anything other that C:\, like C:\temp\data, the line in blue fails. I don't know why that is either. Please help.