after some months of Trial and Error...
I still can't import or transfer a Feature Class to a Feature Dataset... :p
I know I'm very close to achieving it...
using some sample codes from esri and other gis guru from the forum...
I have import a shapefile into a GDB...
But what I wanted is to convert a shapefile into a Feature Class and add it to a Feature Dataset...
I think IFeatureDataset must be used but I don't know how to use it...
Hope someone can help me...
here the code i'm using...
i think it's somewhere in this code that the IFeatureDataset must be added...
I still can't import or transfer a Feature Class to a Feature Dataset... :p
I know I'm very close to achieving it...
using some sample codes from esri and other gis guru from the forum...
I have import a shapefile into a GDB...
But what I wanted is to convert a shapefile into a Feature Class and add it to a Feature Dataset...
I think IFeatureDataset must be used but I don't know how to use it...
Hope someone can help me...
here the code i'm using...
i think it's somewhere in this code that the IFeatureDataset must be added...
Code:
Dim sourceWorkspaceFactory As IWorkspaceFactory = New ShapefileWorkspaceFactoryClass()
Dim targetWorkspaceFactory As IWorkspaceFactory = New FileGDBWorkspaceFactoryClass()
Dim sourceWorkspace As IWorkspace = sourceWorkspaceFactory.OpenFromFile(shpPath, 0)
Dim targetWorkspace As IWorkspace = targetWorkspaceFactory.OpenFromFile(gdbPath, 0)
' Cast the workspaces to the IDataset interface and get name objects.
Dim sourceWorkspaceDataset As IDataset = CType(sourceWorkspace, IDataset)
Dim targetWorkspaceDataset As IDataset = CType(targetWorkspace, IDataset)
Dim sourceWorkspaceDatasetName As IName = sourceWorkspaceDataset.FullName
Dim targetWorkspaceDatasetName As IName = targetWorkspaceDataset.FullName
Dim sourceWorkspaceName As IWorkspaceName = CType(sourceWorkspaceDatasetName, IWorkspaceName)
Dim targetWorkspaceName As IWorkspaceName = CType(targetWorkspaceDatasetName, IWorkspaceName)
' Create a name object for the shapefile and cast it to the IDatasetName interface.
Dim sourceFeatureClassName As IFeatureClassName = New FeatureClassNameClass()
Dim sourceDatasetName As IDatasetName = CType(sourceFeatureClassName, IDatasetName)
sourceDatasetName.Name = shpName
sourceDatasetName.WorkspaceName = sourceWorkspaceName
' Create a name object for the FGDB feature class and cast it to the IDatasetName interface.
Dim targetFeatureClassName As IFeatureClassName = New FeatureClassNameClass()
Dim targetDatasetName As IDatasetName = CType(targetFeatureClassName, IDatasetName)
targetDatasetName.Name = newFCName
targetDatasetName.WorkspaceName = targetWorkspaceName