Are you looking for something like this
string dbName = "Northwind" ;
SQLDMO.Database db = new SQLDMO.Database ();
SQLDMO.SQLServe r srv = new SQLDMO.SQLServe r();
srv.Name = "(local)";
srv.LoginSecure = true;
srv.Connect(nul l,null,null);
db = (SQLDMO.Databas e)srv.Databases .Item(dbName,nu ll);
MessageBox.Show ("I have in my hand this database - " + db.Name + " it is
this big " + db.Size.ToStrin g());
srv.DisConnect( );
--
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know
"T." <T@discussions. microsoft.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
I dumped VB and adopted C# for this version of Visual Studio. My problem!
I am trying to reference an SQLDMO.Database object in C# like so:
private SQLDMO.Database dbcurrent;
private string dbname;
dbname = "Northwind" ;
dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.Item(dbname );
But I get this error : No overload for method 'Item' takes '1' arguments.
I was hoping to avoid iterating through the SQLDMO.Database s collection to
obtain the ID of the database I want, and reference my target database via
that ID.
e.g. dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.ItemByID(i) ;
Any suggestions? And thanks in advance