|
-
February 8th, 2000, 11:54 AM
#1
Available Databases?
Hi,
Does anyone know how to give a user a selection of available databases in SQL SERVER 6.5 using VB
ie
When they log in the can choose between different databases.
This is when I'm using OLEDB as I know that with ODBC I can just change the default database in the control panels but I can't see a way of doing this sort of thing with OLEDB where you hard code the INITIAL CATALOG and I don't want to use an INI file to select the database I'm working with.
Hope this makes sense
Cheers.
-
February 8th, 2000, 01:13 PM
#2
Re: Available Databases?
Here is some code that I use to do this:
Dim RS as Recordset
Dim sSQL as string
sSQL = "SELECT Name FROM Master..SysDatabases (nolock)"
set RS = Conn.Execute(sSQL)
cboDB.Clear
Do While Not RS.EOF
cboDB.AddItem RS!Name
RS.MoveNext
Loop
The master database is a wonderful thing. But the master database is sort of like the registry on your PC - it holds info about everything, so if one thing gets messed up, the whole DB could blow up.
Hope this helps,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|