ArcObjects Library Reference (DataSourcesGDB)  

IDataServerManager.Connect Method

Connects to an initialized Data Server.

[Visual Basic .NET]
Public Sub Connect ( _
)
[C#]
public void Connect (
);
[C++]
HRESULT Connect(
void
);

Product Availability

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

Description

This function connects to a Database Server.

Errors Returned

-2147212030 - FDO_E_CANNOT_CONNECT_TO_SERVER

Connect will return this error if it fails to connect to the Database Server for some reason.   Use the IServiceControl.ServerStatus property to determine if the server is running and accepting connections.

Remarks

The DataServerManager must be initialized by using put_ServerName or InitFromFile.  You must already be a user on the server, with the appropriate permissions, in order to connect to it.

[C#]

// The following code example demonstrates how to extablish a connection to a database server
public void esriDataSourcesGDB__IDataServerManager()
{
    // Create a Data Server Manager object
    IDataServerManager dataserverManager = new DataServerManagerClass();
    dataserverManager.ServerName = "minnie\\sqlexpress";

    dataserverManager.Connect();
}

See Also

IDataServerManager Interface

.NET Related Topics

Connecting to a geodatabase | Creating geodatabases | DataSourcesGDB |