xSQL Schema Compare SDK version 9.5 for SQL Server
SqlDatabase Class
Members  Example 


Represents a SQL Server database. Represents a SQL Server database.
Object Model
SqlDatabase Class
Syntax
'Declaration
 
Public NotInheritable Class SqlDatabase 
   Inherits SqlScriptableEntity
   Implements IExtendedPropertyIPermission 
public sealed class SqlDatabase : SqlScriptableEntity, IExtendedPropertyIPermission  
public __gc __sealed class SqlDatabase : public SqlScriptableEntity, IExtendedPropertyIPermission  
Remarks
The SqlDatabase class cannot be instantiated directly. Use instead the SqlServer.GetDatabase(string) method to create a new instance of the SqlDatabase class.The SqlDatabase class cannot be instantiated directly. Use instead the SqlServer.GetDatabase(string) method to create a new instance of the SqlDatabase class.
Example
The following code snippet shows how to create a database objects: To get all user databases from a SQL Server instance, use the method: SqlServer.GetDatabases().The following code snippet shows how to create a database objects: To get all user databases from a SQL Server instance, use the method: SqlServer.GetDatabases().
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; use Windows authentication
            server = new SqlServer(@"(local)");
            
            //--create the database object
            database = server.GetDatabase("AdventureWorks");
            
        }
    }
}
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; use Windows authentication
            server = new SqlServer(@"(local)");
            
            //--create the database object
            database = server.GetDatabase("AdventureWorks");
            
        }
    }
}
Inheritance Hierarchy

System.Object
   xSQL.Schema.Core.Entity
      xSQL.Schema.SqlServer.SqlEntity
         xSQL.Schema.SqlServer.SqlSerializableEntity
            xSQL.Schema.SqlServer.SqlScriptableEntity
               xSQL.Schema.SqlServer.SqlDatabase

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

SqlDatabase Members
xSQL.Schema.SqlServer Namespace

 

 


┬ęCopyright 2018 xSQL Software. All Rights Reserved.

Send Feedback