xSQL Schema Compare SDK for SQL Server version 12
GetDatabase(String) Method

The name of the database.
Returns the database object with the specified name. The SQL Server connection uses the Windows Authentication.
Public Overloads Function GetDatabase( _
   ByVal dbName As System.String _
) As SqlDatabase
public SqlDatabase GetDatabase( 
   System.string dbName
public: SqlDatabase* GetDatabase( 
   System.string* dbName


The name of the database.

Return Value

A SqlDatabase database with the specified name.
System.ArgumentNullExceptionThe database is null.
System.ArgumentExceptionThe database is an empty string.
SchemaExceptionThe database is not found.
The SqlDatabase class cannot be instantiated directly. Use this method to create a database object.
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

See Also


SqlServer Class
SqlServer Members
Overload List



┬ęCopyright 2022 xSQL Software. All Rights Reserved.

Send Feedback