[thelist] Getting SQL Servers
Tab Alleman
talleman at autobex.com
Wed Feb 21 16:04:27 CST 2001
I still haven't figured out how to search a LAN for available SQL Servers,
but here's how you get a list of all the databases on a known sql server
(example is in VB, but translating to VBScript isn't much of a stretch)
caveat: some lines might be wrapping and making things screwy-looking.
<tip type="SQL Server">
'get a list of databases on the SQL Server
Cmd.ActiveConnection = OpenStr 'you define OpenStr as your connection
string prior to this
Cmd.CommandText = "sp_helpdb"
Cmd.CommandType = adCmdStoredProc
Set rs = Cmd.Execute
Do While Not rs.EOF
cmbInitCat.AddItem rs.Fields("Name").Value 'this line is adding each
db name to a combo box.
rs.MoveNext
Loop
</tip>
More information about the thelist
mailing list