This project is read-only.

Access the Orchard.Web SQLCE database

Topics: Administration, Customizing Orchard, Troubleshooting, Writing modules
Mar 2, 2011 at 10:39 AM

The database for my site is located in Orchard.Web\App_Data\Sites\Default.

I'm trying to modify an existing custom content type, so it would be really handy to be able to look at the database to see what tables and columns already exist. Is there any module for viewing the database? Otherwise, could you recommend any external programs that I could use?

Mar 2, 2011 at 1:50 PM

Usually I just check the file Migrations.cs under each module, such as src\Orchard.Web\Modules\Orchard.Users\ Migrations.cs. Here the table name and its column is listed clearly.

Mar 2, 2011 at 6:52 PM

WebMatrix (which is free) can open SQL CE databases. Visual Studio 2010 SP1 also can do that.

Mar 4, 2011 at 9:21 AM

freeflying1222: Thanks for that, but there are some modules like Orchard.Page that don't have any Migrations.cs file. So my current goal is to make a Migrations.cs file for the part of my current module that was based on Page. Checking the database might not be the best approach to that, but I was trying it out anyway.

bertrandleroy: I'm using VS 2010 SP1, I went to Tools>Connect to Database and selected "Microsoft SQL Server Compact 3.5" as the Data Source. Then for connection properties, I browsed to the file Orchard.Web\App_Data\Sites\Default\Orchard.sdf, but when I clicked "Test Connection" I got the error "This is not a valid SQL Server Compact Database file or this file version is not supported by current SQL Server Compact Engine."

I noticed the doc If you can't tell me how to get the VS route to work, I'll try installing WebMatrix. I've been running Orchard from the VS debugger, not sure if that's the best way to do module development but I found it better than editing the .cs files with notepad.

Mar 4, 2011 at 11:51 AM

in VS 2010, you should have Microsoft SQL Server Compact 4.0 as a data Source.  If not look in Web Platform Installer in IIS. Up at the top just under the header labeled "Web Platform Installer" click on "Products". Install Microsoft Sql Server Compact 4.0.  

Mar 16, 2011 at 8:24 AM
Edited Mar 16, 2011 at 8:30 AM

As of 7/03/201, there is now a new download in the Web Platform Installer 3.0 with the long name Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0. Could come in handy for my problem

Also, the adding of Microsoft Visual Studio 2010 SP1 seems to install these tools as part of the update through the Web Platform Installer even though the about box in VS2010 reported it to be SP1.

Mar 20, 2011 at 6:41 PM

Thanks @tanderson, I confirm that your solution is working. After installing the tools for SQL Server Compact 4.0 and restarting Visual Studio I was able to open the file. I have yet to try the SP1 update.