SQLDMO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this code:

foreach(SQLDMO.Database db in sqlsvr.Databases)
dblist.Add(db.Name.ToString());

But I am getting this error "Object reference not set to an instance of an
object". When I debug this piece of code, db is not an object of type
SQLDMO.Database. It is something else other than the object I want it to be.
How can this be? None of the properties and methods of an SQLDMO.Database
object are exposed in my db variable. I don't get this, I would be grateful
if someone could offer some ideas.

Thanks in advance
 
Hi
There is this snippet that is almost the same of the one you posted
ArrayList aDatabases = new ArrayList();

foreach(SQLDMO.Database dbCurrent in Connection.Databases)
aDatabases.Add(dbCurrent.Name);

return aDatabases.ToArray();
and it claimed to be working on the article on this link
http://www.thecodeproject.com/cs/database/spgen.asp
Check it out i think it will help
Mohamed Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC
 
Back
Top