Can We Integrate Visual Basic.NET, SQL Server 2000 and WMI? (Page 1 of 4 )
This article mainly explains how to integrate WMI with SQL Server 2000, together with the Visual Basic.NET language.
A downloadable file for this article is available here: (http://images.devshed.com/af/stories/Integrate_
VB_SQL_WMI/example.zip).
The sample downloadable solution (zip) is entirely developed using Visual Studio.NET 2003 Enterprise Architect on Windows Server 2003 Standard Edition together with SQL Server 2000 Enterprise Edition. But, I am confident that it would work with other versions of Windows (which support .NET 1.1) as well.
WMI with SQL Server 2000?
Recently, I received a question from one of the readers about whether WMI can be used with the SQL Server 2000 database. That question really brought me up on my toes, so I immediately started an article to achieve the same. Not every developer would know that we can manage SQL Server 2000 using WMI. Another question you might want to ask would be “Is it really necessary to work with WMI?” The answer would be that it is not quite necessary. You have SQL-DMO, which is quite well matured as compared with WMI (of course it cannot even compare). I already introduced SQL-DMO at the following link.
http://www.aspfree.com/c/a/VB.NET/Simple-BackupRestore-
Utility-With-SQLDMO-Using-VBNET/
SQL-DMO is generally used only by SQL server developers and not by system administrators. What if the system administrator wants to access SQL server database information using a common programming model? The answer would be WMI, because WMI is specially made with them (and also with WBEM) in mind. And I introduced WMI with Visual Basic.NET at the following link.
http://www.aspfree.com/c/a/VB.NET/WMI-Programming-
with-Visual-BasicNET-Breaking-the-Ice/
As everyone knows by now, WMI is the initiative for WBEM (Web Based Enterprise Management) to fulfill Microsoft's vision. It has nearly entered into the market of system administrators at the moment. But, in the future, there is no doubt that it would further penetrate into the developer’s world as well. WMI is mainly used to manage tasks. The tasks may not be related to a single piece of software or component. WMI almost works with every Microsoft product.
Just imagine that you have Microsoft products already designed into about 15 to 20 servers (for various scenarios) and you would like to manage several instances of all of them using a common “language.” And WMI achieved it. WMI can work with almost all of them (as almost all of those servers support WMI internally).
And another exciting point about WMI is that you can work with it using either VBScript at the command prompt (or ASP for the web) together with WSH (Windows Script Host), or you can develop very effective applications using the .NET framework. The .NET framework fully supports WMI natively (which is also good news for ASP.NET developers who develop web applications).
As I already introduced the concept of WMI in several articles at this site, I am not going to cover any fundamentals of WMI in this article. In this article, I mainly focus on programming WMI using Visual Basic.NET, with the target server as SQL Server 2000 (which is not well-known to many developers).
Next: How to connect to SQL Server 2000 using WMI >>
More Visual Basic.NET Articles
More By Jagadish Chaterjee