Freigeben über


Setting up Workflow Databases for Persistence and Tracking

Let's just say that I'm not a SQL wiz.  I like to use SQL Server Management Studio express when dealing with databases.  Unfortunately today I was trying to setup the Workflow databases on a machine where I had not installed SQL Management Studio Express yet and I had no Internet connection at the moment (after all it is a free download).

Update: Turns out that running the SQL Management Studio Express Installer in Vista results in a problem where the install fails with error 29506.
Once again Sid (one of our MVP's) had the solution to run the MSI from a command prompt with admin privileges. 

So what is a SQL lamer like me to do?  Whip out the good ol' command line tools.

To save you the trouble here is the command you need.  Assuming that you are running SQL Server Express as the named instance sqlexpress.

Create a new Database using Visual Studio 2008

  1. Start Visual Studio as Admin if on Vista
  2. Open the Server Explorer
  3. Right click on Data Connections
  4. Select Create New SQL Server Database

Run the scripts from the command prompt (yes you can run these from VS if you like)

  1. Open the Visual Studio command prompt (run as administrator if you are on Vista)
  2. CD\Windows\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN
  3. Run the following command (assumes the name of the DB is WorkflowTracking as an example)

sqlcmd -iTracking_Schema.sql -S.\sqlexpress -dWorkflowTracking -E

 

One Other Very Cool Thing I found Today

Suppose you are building a client application and you want to use workflows with persistence.  You need a database right?  Who wants to ask people to install SQL Server (even express) in addition to your app.  Of course SQL Server Compact Edition is the perfect solution.  But wait - you can't run those scripts on it because it doesn't support stored procedures!

Never fear - MVP Maurice de Beijer has created the SQL Server Compact Workflow Persistence Service and shared it with us on MSDN Code Gallery (way to go Maurice!)

Update: If you try to run this code on Vista x64 it will fail with an error "System.Data.SqlServerCe.3.5' not installed."  I puzzled over this for a while until I realized from Steve Lasker's post about SQLCE not being available on x64 yet.  It turns out that you can still use it you just have to target x86 in the build properties of your project.

Comments