ArcObjects Library Reference (DataSourcesGDB)  

IDataServerManagerAdmin.CreateWorkspaceName Method

Creates a Workspace Name object to the Geodatabase.

[Visual Basic .NET]
Public Function CreateWorkspaceName ( _
    ByVal gdbName As String, _
    ByVal versionPropName As String, _
    ByVal versionSpecifier As Object _
) As IWorkspaceName
[C#]
public IWorkspaceName CreateWorkspaceName (
    string gdbName,
    string versionPropName,
    object versionSpecifier
);
[C++]
HRESULT CreateWorkspaceName(
  BSTR gdbName,
  BSTR versionPropName,
  VARIANT versionSpecifier,
  IWorkspaceName** workspaceName
);
[C++]

Parameters

gdbName [in]   gdbName is a parameter of type BSTR versionPropName [in]   versionPropName is a parameter of type BSTR versionSpecifier [in]   versionSpecifier is a parameter of type VARIANT workspaceName [out, retval]

  workspaceName is a parameter of type IWorkspaceName

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned

-2147155518 - SDE_E_SE_INSTANCE_RELEASE_INCOMPATIBLE

This error will be returned when trying to open a WorkspaceName object returned from CreateWorkspaceName if the ArcSDE schema of the Geodatabase requires upgrading.  Run IDataServerManager.UpgradeSDESchema to resolve this error.

-2147216062 - FDO_E_SE_LICENSE_EXPIRED

This error will be returned when trying to open a WorkspaceName object returned from CreateWorkspaceName if the ArcSDE license requires updating.  Detach and Attach the mdf file to update the license. 

Remarks

CreateWorkspaceName takes as input a geodatabase name (gdbName), type of version (versionPropName) and version name (versionSpecifier) and returns a WorkspaceName object to the specified geodatabase and version.

There are 3 valid values for the versionPropName property:

You must initialize the Data Server Manager object before using this method.  The Data Server Manager can be initialized through the use of IDataServerManager.InitFromFile or IDataServerManager.ServerName and then calling IDataServerManager.Connect.

[C#]

// The following code example demonstrates how to establish a connection to a database server in order
// to open an existing workspace\geodatabase
public void esriDataSourcesGDB__IDataServerManager()
{
    // Create a Data Server Manager object
    IDataServerManager dataserverManager = new DataServerManagerClass();
    dataserverManager.ServerName = "minnie\\sqlexpress";

    dataserverManager.Connect();

    // Create a new workspace name object for the geodatabase we want to open
    IDataServerManagerAdmin dataservermanagerAdmin = (IDataServerManagerAdmin)dataserverManager;
    IWorkspaceName workspaceName = dataservermanagerAdmin.CreateWorkspaceName ("Landbase", "VERSION", "dbo.DEFAULT");

    // Open the workspace
    IName name = (IName)workspaceName;
    IWorkspace workspace = (IWorkspace)name.Open();
}

See Also

IDataServerManagerAdmin Interface

.NET Related Topics

Connecting to geodatabases and databases | Creating geodatabases | DataSourcesGDB