Update Orchard theme using SQL statement if the UI does not work anymore

If you create a theme for Orchard, it’s only a matter of time before you stumble across a yellow screen of death. I know this, because it happened multiple times to me. One of the reasons for these errors are the dynamic objects, which are used a lot in Orchard.

You won’t get compile-time errors with these objects, so they need to be handled with care.

Now, when a theme causes a yellow screen you are kind of screwed as you can’t do anything anymore on the website, like logging in to the admin area.

Lucky for us developers, the database isn’t obfuscated and we can make rapid changes to it. You can use this script to update your current Orchard theme and set it back to the default Theme Machine theme.

UPDATE [OrchardDatabaseName].[dbo].[default_Orchard_Themes_ThemeSiteSettingsPartRecord]

   SET [Id] = 1

      ,[CurrentThemeName] = 'TheThemeMachine'


Run the above script on your Orchard database and you will be able to start developing again.

If the above script doesn’t work, check the [default_Orchard_Themes_ThemeSiteSettingsPartRecord]

table entries. You possibly need to change the Id parameter of the script to the one which is the same as in the database


comments powered by Disqus