Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9123049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:14:45+00:00 2026-06-17T06:14:45+00:00

I am trying to get a database collection with smo, like this: var server

  • 0

I am trying to get a database collection with smo, like this:

var server = GetDatabaseServer();

DatabaseCollection databaseCollection = server.Databases;

foreach (Database database in databaseCollection)
{
    if (String.Equals(database.Name, databseName, 
        StringComparison.OrdinalIgnoreCase))
    {
        if (database.IsSystemObject == false && 
            database.IsMirroringEnabled == false)
        {
            if (IsTimeForBackup(database.LastBackupDate)) 
                Backup(database, server, backupDirectory);
            break;
        }    
    }
}

This will work if the SqlServer is 2005 or 2008. If i try to connect to an instance of 2012, i am getting an exception when i check for database.IsMirroringEnabled:

Index was outside the bounds of the array.

The stack trace is : at
Microsoft.SqlServer.Management.Smo.SqlPropertyMetadataProvider.PropertyNameToIDLookupWithException(String
propertyName, PropertyAccessPurpose pap) at
Microsoft.SqlServer.Management.Smo.PropertyCollection.LookupID(String
propertyName, PropertyAccessPurpose pap) at
Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String
propertyName, Boolean throwOnNullValue) at
Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String
propertyName) at
Microsoft.SqlServer.Management.Smo.Database.get_IsSystemObject() at
RBC.StockManagement.CommunicationService.DatabaseBackup.BackupDatabase(String
databseName, String backupDirectory) in
D:\Work\Trunk\RBC.StockManagement\RBC.StockManagement.CommunicationService\DatabaseBackup.cs:line
85

The database that i am trying to backup is created from SqlServer 2005 and my operating system runs on x64 architecture. All three instances of 2005(developer edition), 2008 (express edition) and 2012(express edition) are on the same computer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:14:47+00:00Added an answer on June 17, 2026 at 6:14 am

    It looks from this MSDN article that there were new SMO DLLs shipped with SQL Server 2012, and that it won’t work if you try to connect to a 2012 instance with the older ones.

    References to SMO dlls in older versions of SQL Server must be
    removed, and references to the new SMO dlls that are provided with SQL
    Server 2012 must be included.

    Minimally, you would reference the following:

    • Microsoft.SqlServer.ConnectionInfo

    • Microsoft.SqlServer.Smo

    • Microsoft.SqlServer.Management.Sdk.Sfc

    This related Connect article mentions specifically the error you’re getting trying to connect – so I’m guessing this is the same problem. MS says there that they won’t update the older ones to allow them to connect to 2012, so I guess updating to the new SMO DLLs is your best shot.

    From regular SO contributer Aaron bertrand:

    See this item for Microsoft’s official stance about forward
    compatibility (not going to fix) and backward compatibility (Denali
    SSMS will be able to manage 2000, 2005, 2008, 2008 R2):
    http://connect.microsoft.com/SQLServer/feedback/details/622441

    (Denali was the code name for 2012 before it was released, in case you didn’t know).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to get the most popular productID from my MSSQL Database. This
I'm trying to get a std::string from my database using mysql connexion Here is
I'm trying to get my head round this mind boggling stuff they call Database
I am trying to get an collection of objects out of a database and
I have a database testdb with collection testcol which looks like this: {u'_id': ObjectId('50eeb8029b75941b9af614bd'),
I'm trying to get to grips with regular expressions: I have a database connection
Just trying to get some rows out of a database and loop through but
Im trying to get all Leads / Contact / Accounts from the database. So
I am trying to get cakePHP to update a record in the database as
I am trying to get the last entry from my database based off the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.