This sample illustrates using SQL Distributed Management Objects (SQL-DMO) objects supplied with Microsoft® SQL Server™ 2000. This Microsoft® Visual Basic® sample demonstrates how to locate the available SQL servers and log in to them. It also demonstrates how to use SQLDMO events to determine if the login was successful or not.
C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Sqldmo\Vb\Login