Website Design United States, Website Design California, Website Designing United States, Website Designing California

SQL-DMO - Returning a list of Stored Procedures - Visual Basic 6

This sample is a demonstration of using SQL-DMO. It is meant to demonstrate simply connecting to the server and doing an action. In your own usage you will probably expand on it. This sample will list the stored procedures in the database.
' add a reference to SQL-DMO
Public AddSpToCombo(sServer As String, sDatabase As String, cboSp As ComboBox)
Dim oSQLDMO As SQLDMO.Application
Dim oSP As SQLDMO.StoredProcedure
Dim SQLInstance As SQLDMO.SQLServer

Set oSQLDMO = New SQLDMO.Application
Set SQLInstance = New SQLDMO.SQLServer
Set oSP = New SQLDMO.StoredProcedure

' login using windows authentication
SQLInstance.LoginSecure = True
SQLInstance.Connect sServer

' loop through the stored procedures and add the mas ones to the dropdown
For Each oSP In SQLInstance.Databases(sDatabase).StoredProcedures
cboSp.AddItem oSP.Name
Next

SQLInstance.Close

' clean up
Set oSP = Nothing
Set SQLInstance = Nothing
Set oSQLDMO = Nothing
End Sub


WEB DESIGN INDIA
42 B Malviya Nagar , New Delhi-110017

Skype: manmeetsi
Email: support.webdesignindia@gmail.com
Tel: 91-011-40502005, 9810067295

 















 


© 2008-2009 dotnet4all.com