I have a listbox control and need to extract all the databases in the local MSSQl server to listbox control (using sqlconnection)
Code please...
Printable View
I have a listbox control and need to extract all the databases in the local MSSQl server to listbox control (using sqlconnection)
Code please...
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);
}
Quote:
Originally Posted by ksureshreddy27
thanks yar!!!