This looks for me so much to Net code. However you got me with that C what
do you think this code is?
Cor
\\\
Private Function LoadSQLServerList() As Integer
Dim serverIndex As Integer
Dim sqlServers As SQLDMO.NameList
Dim sqlServer As Object
' Get a list of servers
sqlServers = New SQLDMO.Application().ListAvailableSQLServers()
' Iterate through the server names, and add it to the combobox
For Each sqlServer In sqlServers
If Not sqlServer Is Nothing Then
cboServers.Items.Add(sqlServer)
End If
Next
' Send back the count of servers
LoadSQLServerList = cboServers.Items.Count
'table list in a ser
Dim sqlServer As SQLDMO.SQLServer
Dim sqlDB As Object
sqlServer = New SQLDMO.SQLServer()
Try
' Connect to your database with userID and password
sqlServer.Connect(cboServers.Text, txtUserID.Text,txtPassword.Text)
' Check for database names in the server
' This loop adds the database name to another combobox
For Each sqlDB In sqlServer.Databases
If Not sqlDB.Name Is Nothing Then
cboDatabases.Items.Add(sqlDB.name)
End If
Next
Catch Exp As Exception
MsgBox(Exp.ToString)
End Try
////