This document is archived and information here might be outdated.  Recommended version.


IDataServerManagerAdmin.AttachGeodatabase Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (DataSourcesGDB)  

IDataServerManagerAdmin.AttachGeodatabase Method

Attachs an existing database to a server.

[Visual Basic .NET]
Public Sub AttachGeodatabase ( _
    ByVal dbName As String, _
    ByVal dataFileName As String, _
    ByVal logFileName As String _
)
[C#]
public void AttachGeodatabase (
    string dbName,
    string dataFileName,
    string logFileName
);
[C++]
HRESULT AttachGeodatabase(
  BSTR dbName,
  BSTR dataFileName,
  BSTR logFileName
);
[C++]

Parameters dbName [in] dbName is a parameter of type BSTR dataFileName [in] dataFileName is a parameter of type BSTR logFileName [in] logFileName is a parameter of type BSTR

Product Availability

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

Remarks

The AttachGeodatabase method allows a Geodatabase to be attached to a Database Server.   The dataFileName parameter must contain the full path name to the mdf file to be attached, for example: "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDatabase.mdf".    The logFileName is an optional parameter, i.e., you can set it to 0.  If not specified, the log file will be re-created.  The Geodatabase must first have been detached from a database server, before it can be attached.

You must be a server administrator to perform this operation.

[C#]

dataServerManagerAdmin.AttachGeodatabase("Version_Test", "C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\Version_Test.mdf", "");

See Also

IDataServerManagerAdmin Interface