SharePoint Short #15
Looking for a quick an easy way of retrieving the default content database information, like the SQL instance (i.e. servername\instance)?
string sqlServerInstance = SPWebService.ContentService.DefaultDatabaseInstance.NormalizedDataSource; |
or individually
string sqlInstance = SPWebService.ContentService.DefaultDatabaseInstance.Instance; string sqlServer = SPWebService.ContentService.DefaultDatabaseInstance.Server; |
The SPWebService class provides an easy and quick way of retrieving this, along with the administration database specific properties.