Beispiel #1
0
        internal void DropTable(View view)
        {
            SqlSchema  sqlSchema = new SqlSchema();
            IDbCommand command   = sqlSchema.GetCommand();

            using (command.Connection = sqlSchema.GetConnection(view.Database.ConnectionString))
            {
                command.Connection.Open();

                if (sqlSchema.IsViewExists(view.Name, command))
                {
                    sqlSchema.DropView(view.Name, command);
                    if (!string.IsNullOrEmpty(view.EditableTableName))
                    {
                        if (sqlSchema.IsTableExists(view.EditableTableName, command))
                        {
                            sqlSchema.DropTable(view.EditableTableName, command);
                        }
                    }
                }
                else
                {
                    if (sqlSchema.IsTableExists(view.Name, command))
                    {
                        sqlSchema.DropTable(view.Name, command);
                    }
                }
                logger.Log("ProductMaintenance", "RemoveApp", "DropTable", null, 3, "In Catalog " + command.Connection.Database + " view:" + view.Name + " and his editable table was droped ");
            }
        }
Beispiel #2
0
        internal void DropTable(string tableName, string connectionString)
        {
            SqlSchema sqlSchema = new SqlSchema();
            // SqlAccess sqlAccess= new SqlAccess();
            IDbCommand command = sqlSchema.GetCommand();

            try
            {
                using (command.Connection = sqlSchema.GetConnection(connectionString))
                {
                    command.Connection.Open();
                    if (sqlSchema.IsTableExists(tableName, command))
                    {
                        sqlSchema.DropTable(tableName, command);
                    }
                }
            }
            catch (System.Data.SqlClient.SqlException exception)
            {
                logger.Log("ProductMaintenance", "RemoveApp", "DropTable", null, 3, "In Catalog " + command.Connection.Database + " view:" + tableName + " Fail!!!! was droped ");
            }
            logger.Log("ProductMaintenance", "RemoveApp", "DropTable", null, 3, "In Catalog " + command.Connection.Database + " view:" + tableName + " and his editable table was droped ");
        }