.NET and related technologies

Archive for April, 2011

How to *Sync* Google Calendar with Windows Live Calendar (via Outlook)

There are many reasons why you may want to keep Google Calendar and Windows Live Calendar in sync. You might want to keep your phone calendar (synchronised via Google Calendar) in sync with multiple PCs with Outlook installed (via Outlook Hotmail Connector). You may also have multiple phones, some of which rely on Google Calendar, others which rely on Windows Live Calendar. Basically, if you use both of the services, it is a good idea to keep them in sync.

You will need:

  1. Microsoft Outlook (2003 or later, 32bit)
  2. Microsoft Outlook Hotmail Connector (32 bit)
  3. Google Calendar Sync

The key here is to make the Hotmail/Windows Live account the default data file in Outlook – it is this default with which Google Calendar Sync will synchronise. If you have other data files, it may be worth transferring your mail to Hotmail so that it is all in one place and deleting them so you only have one data file (synchronised with Hotmail) to manage. Data files can be managed via the File > Data File Management option in Outlook (or equivalent on the ribbon).

By setting the Hotmail/Windows Live account as the default, your rules will also work in Outlook 2003/2007 (they work regardless in 2010).

Let me know if you have any problems or found this advice useful 🙂


Designing an ERD in Visio for SQL Server Express or SQL Server CE

I have been looking for a good few hours this Easter holiday for an effective way of designing an entity relationship diagram (ERD) in Visio and transforming it into a real SQL Server CE (Compact Edition – e.g. a database embedded in a .NET application executable, executing with the application at runtime) database shell. Visio is an excellent diagramming tool for this purpose, but I was hunting for hours for an export button to export the shape details to a database or DDL.

Now I have found an effective solution, I thought I would share what I found in the hope that someone else find’s this useful – feel free to post a comment to let me know!

You will need:

  1. Microsoft Visio 2010 (any edition)
  2. Forward Engineer for Visio 2010
  3. Microsoft SQL Server Management Studio Express 2008

The setup version for the latest version (1.0.6) of Forward Engineer (http://forwardengineer.codeplex.com/) is 64bit, despite containing a 32bit/x86 add-on to Visio. If you run the setup.exe on 32bit/x86 Windows you will get the error message “The version of this file is not compatible with the version of Windows you’re running. Check your computer’s system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.” To get around this issue you will need to first extract the contents (e.g. using WinRAR) before running the enclosed 32bit installer.

If you already have SQL Server 2008 Express installed, you may have problems installing Microsoft SQL Server 2008 Management Studio Express. You will need to perform a new installation (as opposed to adding features to an existing one) and (re)install the service pack 2 update (available through Windows Update) afterwards.

You can then design your database in Visio, use the Forward Engineer ribbon add-in to check and output your database as SQL DDL and execute this SQL in SQL Server Management Studio Express.

If you are using SQL CE then you will need to read on…

Note that Forward Engineer outputs code designed for SQL Server Express, not SQL Server CE. You will therefore need to manually alter the DDL to remove the syntax which SQL CE doesn’t support (don’t worry, this isn’t much work).

You will need to remove any occurrences of the following syntax:

  • CHAR (change this to NVARCHAR)

You will also need to remove the table prefix e.g. [dbo]. before each table name. You may also need to add additional GO commands between ALTER TABLE commands.

Hopefully with these changes your script should execute, let me know if you have any problems or need further guidance Smile