Home All Groups Group Topic Archive Search About

CS0117 error accessing SMO DatabaseCollection.Item property

Author
26 Jan 2006 8:24 PM
Rick Razzano
When I run the code below, I get the following error:
'Microsoft.SqlServer.Management.Smo.DatabaseCollection' does not
contain a definition for 'Item'

I am using .NET 2.0.50727.42 with the RTM release of SQL Server 2005.
The documentation for the DatabaseCollection object includes the Item
property.  Am I missing something?

using System;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;

namespace SMOUtils
{
    class Program
    {
     static void Main()
     {
      ServerConnection conn = new ServerConnection("MYSERVER");
      conn.LoginSecure = true;
      Server svr = new Server(conn);
      DatabaseCollection dbs = svr.Databases;
      Database db = dbs.Item("mydb");
     }
   }
}

AddThis Social Bookmark Button