IDbViewManager..::.DropView Method
.NET Framework Class Library
IDbViewManager..::.DropView Method

Removes a view from the database.

Namespace:  Microsoft.Web.Management.DatabaseManager
Assembly:  Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)
Syntax

'Usage

Dim instance As IDbViewManager
Dim connectionString As String
Dim schema As String
Dim viewName As String

instance.DropView(connectionString, schema, _
    viewName)

'Declaration

Sub DropView ( _
    connectionString As String, _
    schema As String, _
    viewName As String _
)

Parameters

connectionString
Type: System..::.String
The connection string for the database.
schema
Type: System..::.String
The schema name for the view.
NoteNote:

If schema is empty, the default schema name will be used.

viewName
Type: System..::.String
The name of the view to drop.
Remarks

All database providers that implement the IDbViewManager interface must also implement the DropView method, which the database manager will use to remove a view from a database.

Notes for Implementers

If your provider does not support deleting views, you can use the following code sample to raise a not-implemented exception:

public void DropView(string connectionString, string schema, string viewName)

{

   throw new NotImplementedException();

}

NoteNote:

See the DROP VIEW (Transact-SQL) topic for more information about the DROP VIEW SQL statement.

Examples

The following code sample implements the DropView method to remove a view from a database in an OLEDB data source.


    ' Remove a view from the database.
    Public Sub DropView( _
            ByVal connectionString As String, _
            ByVal schema As String, _
            ByVal viewName As String) _
            Implements Microsoft.Web.Management.DatabaseManager.IDbViewManager.DropView

        ' Create a new database connection.
        Dim connection As OleDbConnection = New OleDbConnection(connectionString)
        ' Create the SQL for the CREATE VIEW statement.
        Dim dropView As String = String.Format("DROP VIEW {0}", EscapeName(viewName))
        ' Create an OLEDB command object.
        Dim command As OleDbCommand = New OleDbCommand(dropView, connection)
        ' Open the database connection.
        connection.Open()
        ' Execute the SQL statement.
        command.ExecuteNonQuery()

    End Sub



Permissions

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
See Also

Reference

© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View