Knight Data Access Layer
GetDatabases Method (IDataHelper)
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface : GetDatabases Method
Get a list of the databases or schemas on the database server. For providers that do not support multiple databases or schemas, the list will be empty.
Syntax
Function GetDatabases() As List(Of String)
Dim instance As IDataHelper
Dim value As List(Of String)
 
value = instance.GetDatabases()
List<string> GetDatabases()
List<string*>* GetDatabases(); 
List<String^>^ GetDatabases(); 

Return Value

A list of databases or schemas
Example
//Get the current thread static safe instance of the helper
SqlServerProvider provider = new SqlServerProvider();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
db.OpenConnection();
List<string> databases = _db.GetDatabases();
 
Console.WriteLine(databases.Count);
 
db.CloseConnection();
'Get the current thread static safe instance of the helper
Dim provider As New SqlServerProvider()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
Dim connnectionString As String = "Data Source=TestServer;Initial Catalog=TestDatabase;Integrated Security=SSPI;"
'db.LicenseKey = "asdfl219=="
 
db.OpenConnection()
Dim databases As List(Of String) = _db.GetDatabases()
 
Console.WriteLine(databases.Count)
 
db.CloseConnection()
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IDataHelper Interface
IDataHelper Members