SMO stands for Shared Management Objects. It is a SQL administration API used to get meta data information from SQL Server. You may ask “Why? I can already do that”. True, but what if your only need was to have a tool that could do some of the following:
- Backups and restores
- Create some test databases
- Maybe even export some SQL Server related information to an Excel Spreadsheet
This tutorial focuses on getting started using this powerful API in your .NET applications. Mind you, this is not a replacement for SQL Server Management Studio (SSMS). This tutorial just gives you the initial steps you need to progress more in the SMO related technosphere.
What Do You Need to get Started?
- SQL Server 2005 onwards
- Shared Management Objects Installed (Required Assemblies)
- Visual Studio Professional or Express editions (2005 onwards)
..and finally, the will and enthusiasm to build your first SMO application.
For this tutorial we’ll be using:
- Visual Basic 2010 Express Edition
- SQL Server 2008 SP1 with Shared Management Objects
- Along with the following assemblies to be imported:
What Are We Going to Accomplish?
To keep things simple we are going to populate a list of databases from the SQL Server Express instance, similar to SQL Server Management Studio. Let’s begin.
1) Launch Visual Basic Express Edition 2010. Click on File > New Project > Windows Application as shown in the screen below. Enter the Project name as you please. I have entered SMOApp:
2) Now from the Toolbox place a TreeView Control onto the Form. Dock it to the left.
3) Next let us turn our attention to adding the needed assemblies. Right click on References > Add Reference:
4) Now your References should resemble as shown below:
5) So now that everything’s in place, let’s start coding!! Yeah!!
Double click the form to launch the Code Window and copy and paste the code as shown below:
Public Class Form1
Public Sub LoadDB()
‘Declare an instance of the Server Class along with the Connection String
Dim Mysvr As New Server(".\SQLEXPRESS")
‘Declare a Database Variable that will enumerate in the TreeView
Dim db As New Database
‘Now iterate through the list of databases within the server
For Each db In Mysvr.Databases
‘We are now going to populate the TreeView Nodes with the Databases
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Catch ex As SqlServerManagementException
MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error)
I have added some beautification to simulate it like a real Database Explorer as shown below. Feel free to experiment with your own images. The final output is shown below:
Well, wasn’t that easy ?
The next article in the series is coming soon. Do let me know your feedback.Posted by Anil Mahadev on November 17th, 2014 under Uncategorized | Comment now »
We all know and have been hearing about NoSQL systems since the last year or so! 2014 is slated to be the year of NoSQL DB Platforms and Big Data Implementations.
Well MongoDB one of the leading NoSQL Database providers are making waves.
You might think why would one want to data model a schema-less database?
Let this video show you how!
[Video Credit: Robert Loranger - Product Manager - ER/Studio]
For more details check out this link
To learn more about us click here
In this new latest release, we now have more than 250 Free Apps that you can try out and experience AppWave.
Some of the key additions to the AppWave 3.0 release are AppWave Editions
In the next series of blog posts, we shall explore on How-To Master an App in AppWave and Broadcast the same.
We shall be mastering a simple Delphi Native 32 bit EXE using an Installer and from scratch using only the single executable.
In the meantime, you may download AppWave hereAppWave | Comment now »
Installed AppWave successfully from my previous blog post! Great Job!!
In this blog post, we shall take a look now on how to install the AppWave Browser
Please click on the link below to watch the Video
As always, if you have any questions / comments / suggestions about this blog, please feel free to leave a comment below.
See you in the next blog post where, I shall show you how to get started with AppWave!Posted by Anil Mahadev on November 28th, 2011 under AppWave | Comment now »
In this blog post, we shall learn how easy it is to install Appwave.
Please feel to download and install AppWave.
[Steps for a Seamless AppWave Install]
- To Download AppWave click on the link below
[AppWave Install Video]
2. Once Downloaded, follow the instructions shown in the video above
Please feel free to comment on your thoughts about the Video / blog post.
Go AppWave! - Get your Applications to the Apps! WorldPosted by Anil Mahadev on November 28th, 2011 under AppWave | Comment now »
What is AppWave?
Today AppWave is an Enterprise Private PC App Store platform that broadcasts your Apps to your end-users in a seamless and yet effective way.
Key components of AppWave
- AppWave Host - The actual software that powers the applications being broadcasted, downloaded from the Embarcadero AppWave Host
- AppWave Streaming Service - The part that runs as a Windows Service, in order to enable the application delivery to your end user from AppWave. This is a vital component, without which, you cannot broadcast your apps
- AppWave Browser - This component enables the Mastering and Broadcasting process of converting your Applications into AppsNow goodbye to Applications and say Hello! Apps!
In the forthcoming post, I shall be posting a video on how easy it is to be installing AppWavePosted by Anil Mahadev on November 28th, 2011 under AppWave | Comment now »
I represent Embarcadero Technologies as the Principal Software Consultant in India.
This blog is catered towards our products and solutions, both from a Developer and DBA perspective.
I will be initially be focussing on a series of blog posts about Embarcadero AppWave, The enterprise platform that delivers a true mobile like experience for your end users.
This will include, basic how-to’s and AppWave Snacks for accomplishing basic tasks within Embarcadero
I look forward towards your viewership and appreciate any comments or feedback during the course of this blog
In the mean time, please feel free to surf through my colleagues blogs on
Vsevolod Leonov (http://blogs.embarcadero.com/vsevolodleonov)
Pawel Glowacki (http://blogs.embarcadero.com/pawelglowacki)Posted by Anil Mahadev on November 28th, 2011 under AppWave | Comment now »