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


The name of the database.
The connection string that contains credentials and other settings to connect to the SQL Server.
Returns the database object with the specified name, connecting to the SQL Server using the specified connection string.
Syntax
'Declaration
 
Public Overloads Function GetDatabase( _
   ByVal dbName As System.String, _
   ByVal connectionString As System.String _
) As SqlDatabase
public SqlDatabase GetDatabase( 
   System.string dbName,
   System.string connectionString
)
public: SqlDatabase* GetDatabase( 
   System.string* dbName,
   System.string* connectionString
) 

Parameters

dbName
The name of the database.
connectionString
The connection string that contains credentials and other settings to connect to the SQL Server.

Return Value

A SqlDatabase object with the specified name.
Exceptions
ExceptionDescription
System.ArgumentNullException

The dbName parameter is null

or

The connectionString parameter is null

System.ArgumentException

The dbName parameter is an empty string

or

The connectionString parameter is an empty string

SchemaExceptionThe database is not found.
Remarks
Call this method when you wish to use a dedicated connection for the database rather than the credentials of the parent SQL Server.
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

SqlServer Class
SqlServer Members
Overload List

 

 


©Copyright 2022 xSQL Software. All Rights Reserved.

Send Feedback