|
-
Sep 27th, 2007, 05:05 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Getting Database names
I have a listbox control and need to extract all the databases in the local MSSQl server to listbox control (using sqlconnection)
Code please...
Last edited by Hack; Sep 27th, 2007 at 07:53 AM.
Reason: Added RESOLVED to thread title and green resolved checkmark
gh
-
Sep 27th, 2007, 06:18 AM
#2
New Member
Re: Getting Database names
using SQLDMO; (By adding reference to SQLDMO.dll)
SQLDMO.SQLServerClass objSQLServer = new SQLDMO.SQLServerClass();
objSQLServer.Connect("server", "username", "password");
foreach ( SQLDMO.Database db in objSQLServer.Databases)
{
ListBox2.Items.Add(db.Name);
}
Last edited by ksureshreddy27; Sep 27th, 2007 at 06:32 AM.
-
Sep 27th, 2007, 06:50 AM
#3
Thread Starter
Hyperactive Member
Re: Getting Database names
 Originally Posted by ksureshreddy27
using SQLDMO; (By adding reference to SQLDMO.dll)
SQLDMO.SQLServerClass objSQLServer = new SQLDMO.SQLServerClass();
objSQLServer.Connect("server", "username", "password");
foreach ( SQLDMO.Database db in objSQLServer.Databases)
{
ListBox2.Items.Add(db.Name);
}
thanks yar!!!
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
|