MS SQL Server
  Home arrow MS SQL Server arrow Retrieving SQL Server 2005 Database Info U...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

Retrieving SQL Server 2005 Database Info Using SMO: Basics
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 10
    2006-01-31

    Table of Contents:
  • Retrieving SQL Server 2005 Database Info Using SMO: Basics
  • Creating the Visual Studio 2005 solution to connect to SMO
  • Connecting to the SQL Server database using SMO
  • Understanding the SMO connectivity
  • How do we retrieve “Database” Information about a particular SQL Server instance using SMO?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Retrieving SQL Server 2005 Database Info Using SMO: Basics


    (Page 1 of 5 )

    This article focuses on retrieving SQL Server 2005 information using SMO together with Visual Basic 2005 and Visual Studio 2005.
    A downloadable file for this article is available here.

    The entire demonstration solution has been developed using SQL Server 2005 Enterprise Edition and Visual Studio 2005 Professional Edition on Windows Server 2003 Standard Edition.  Note that I didn’t really test the solution on any of other versions/editions of similar suites of Microsoft products. 

    What the hell are “DMO” and “SMO”?

    SQL Distributed Management Objects (SQL-DMO) is a collection of objects encapsulating Microsoft® SQL Server™'s database and replication management. SQL-DMO is a dual interface COM, in-process server implemented as a dynamic-link library (DLL). SQL-DMO encapsulates SQL Server components, presenting the attributes of the component piece to you as the properties of an object instance. We can alter the properties of the instance, or use object methods to automate SQL Server administration, including replication.  Now, this whole issue is becoming as an old story.

    The SMO object model extends and supersedes the Distributed Management Objects (SQL-DMO) object model. Microsoft defines SMO as follows: “SQL Server Management Objects (SMO) are objects designed for programmatic management of Microsoft SQL Server. You can use SMO to build customized SQL Server management applications.”  In fact, we can consider SMO to be further enhanced than DMO.  The most wonderful feature of SMO is that it is implemented as a .NET assembly.

    If you would like to work with DMO (or SQL-DMO), we need to work with some of the COM interoperability issues together with .NET (which is a bit complicated in certain cases).  Coming to the case of SMO, we can straight away integrate it into any .NET based applications.  SMO is also compatible with SQL Server version 7.0, SQL Server 2000, and SQL Server 2005, which makes it easy for you to manage a multi-version environment.  In fact, the SMO model supersedes and replaces SQL-DMO.  If you are interested in working with SQL-DMO, you can look at another article of mine dedicated to it at http://www.aspfree.com/c/a/VB.NET/Simple-BackupRestore-Utility-With-SQLDMO-
    Using-VBNET/1/

    To work with SMO, we should learn about the hierarchy of the SMO Object Model.  Within the huge hierarchy of the SMO Object model, “server” objects stays at the top.  The “server” object generally needs to connect “SQL Server” and from there on, we can retrieve or manage SQL Server database information very easily.

    The following sections shall help you to retrieve SQL Server database information using SMO together with Visual Basic 2005.  Let’s start now.

    More MS SQL Server Articles
    More By Jagadish Chaterjee


       · Hi guys, delve into SMO of SQL Server 2005 with this contribution. Have any doubts...
       · You mention that SMO supports Sql Server 7.0. When I tried using it to access my...
       · Hai, it is possible to work with SMO on SQL Server 7.0/2000, if and only if we...
       · Hi your article is pretty good,I use to use dmo and I wonder how to get all the...
     

    MS SQL SERVER ARTICLES

    - Windows Server 2008 as a Workstation OS
    - An Overview of Windows Server 2008 R2
    - LINQ to MySQL, Oracle and PostgreSQL Provide...
    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek