Returns the database object with the specified name. The SQL Server connection uses the Windows Authentication.
'Declaration
Public Overloads Function GetDatabase( _
ByVal As System.String _
) As SqlDatabase
public SqlDatabase GetDatabase(
System.string
)
public: SqlDatabase* GetDatabase(
System.string*
)
Parameters
- dbName
- The name of the database.
Return Value
A
SqlDatabase database with the specified name.
The following example demonstrates how to create a database object:
using xSQL.Schema.Core;
using xSQL.Schema.SqlServer;
using xSQL.SchemaCompare.SqlServer;
namespace xSQL.Sdk.SchemaCompare.Samples
{
class Test
{
public static void CreateDatabase()
{
SqlServer server;
SqlDatabase database;
//--initialize the SQL Server object
//--this constructor uses Windows authentication to establish the connection
server = new SqlServer(@"(local)");
//--create the database object for AdventureWorks
database = server.GetDatabase("AdventureWorks");
}
}
}
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