Public Sub DropTable(ByVal connectionString As String, ByVal schema As String, ByVal tableInfo As Microsoft.Web.Management.DatabaseManager.TableInfo) Implements Microsoft.Web.Management.DatabaseManager.IDbTableManager.DropTable
' Create a connection to the database.
Dim connection As OleDbConnection = New OleDbConnection(connectionString)
' Open the connection to the database.
connection.Open()
' Begin a transaction.
Dim transaction As OleDbTransaction = connection.BeginTransaction
Try
' Create the DROP TABLE SQL statement.
Dim dropStatement As String = String.Format("DROP TABLE {0}", EscapeName(tableInfo.Name))
' Create an OLEDB command object.
Dim command As OleDbCommand = New OleDbCommand(dropStatement, connection)
' Specify the transaction.
command.Transaction = transaction
' Run the SQL statement.
command.ExecuteNonQuery()
' Commit the transaction.
transaction.Commit()
Catch ex As Exception
' Roll back the transaction.
transaction.Rollback()
' Raise an exception if an error occurs.
Throw New ProviderException(("DROP TABLE Exception:" + vbCrLf + vbCrLf + ex.Message))
Finally
' Close the database connection.
connection.Close()
End Try
End Sub