The following code sets up an SDE workspace factory and workspace. The workspace is then asked for it's feature dataset names. The names are returned as an enumeration which is cycled through and the name of each dataset is added to a list box.
[Visual Basic 6.0]
Dim pSdeWorkspaceFactory As IWorkspaceFactory
Dim pSdeWorkspace As IWorkspace
Dim pSdeDSName As IDatasetName
Dim pEnumDSName As IEnumDatasetName
Set pSdeWorkspaceFactory = New SdeWorkspaceFactory
Set pSdeWorkspace = pSdeWorkspaceFactory.OpenFromFile("D:\data\redarrow.sde")
Set pEnumDSName = pSdeWorkspace.DatasetNames(esriDTFeatureDataset)
Set pSdeDSName = pEnumDSName.Next
While Not pSdeDSName Is Nothing
List1.AddItem pSdeDSName.Name
Set pSdeDSName = pEnumDSName.Next
Wend
[C#]//IWorkspace DatasetNames Example
public void IWorkspace_DatasetNames_Example(IWorkspace workspace)
{
//This function asks the workspace for its feature dataset names.
//The names are returned as an enumeration which is cycled through and the
//name of each dataset is printed.
IEnumDatasetName enumDatasetName = workspace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset);
IDatasetName datasetName = enumDatasetName.Next();
while (datasetName != null)
{
Console.WriteLine(datasetName.Name);
datasetName = enumDatasetName.Next();
}
}
[Visual Basic .NET, C++]
No example is available for Visual Basic .NET or C++. To view a Visual Basic 6.0 or C# example, click the Language Filter button
in the upper-left corner of the page.