Wednesday, April 30, 2008

SQL Server CE 3.0 version inconsistencies

Many people in the community are reporting inconsistencies when viewing the version of SQL Server CE 3.0 through File Explorer file properties and Visual Studio Add Reference dialog.

I use SQL Server Compact 3.5 (note the naming differences) now which seems to be OK in terms of versioning. But earlier versions (3.0, 3.1) don't. See the screen shots attached.


As per Visual Studio.


As per the file system.

This diference is related to the build process between Mobile and Desktop assemblies. Microsoft has partially fixed SQL Server CE 3.1 but fully fixed SQL Server Compact 3.5.

Tuesday, April 29, 2008

Develop SQL Server Compact 3.5 apps with VS 2005

UPDATE 01 June 08: This is quite confusing but you can use VS 2008 RTM to manipulate a SQL Server Compact 3.5 database but not SQL Server 2008 database unless you install the newly released VS 2008 Beta Service Pack 1: http://simonrhart.blogspot.com/2008/05/visual-studio-2008-and-net-framework-35.html

I see this question asked all the time in the community, "Can I use SQL Server Compact 3.5 with Visual Studio 2005" the answer is Yes.

Although it is a little bit ugly, but does work. You have to explicitly add the SQL Server Compact manually by clicking on the Browse tab in Add Reference dialog if it doesn't exist in the .NET tab. Of course the limitations are not being able to use Server Explorer in VS 2005 for v3.5 databases and any UI tools that help with data binding etc (as if anyone actually uses these for corporate LOB apps!).

You can use SQL Server Management Studio 2008 to manipulate the SQL Compact 3.5 database or if you haven't got SQL Server 2008 as SQL Server 2008 is not in RTM yet then you can use Visual Studio 2008 Server Explorer to do this.

You can find SQL Server 3.5 engine here(or similar): C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices.

See here for the reasons why you might want to move to SQL Server Compact 3.5 and how to get it.

Tuesday, April 22, 2008

MVP Summit 2008 - recap

Well I'm back from Seattle and what an experience. I love Seattle, it's a kind of city that's more like a town than a city in that people tend to be more laid back than most other cities. I admit I found it smaller and cleaner than expected which adds to its appeal. I think I now have an even bigger caffine addiction than before I left! Unfortunately because of my busy schedule, I didn't have the time I would have liked to explore the city in more detail, maybe next time!

That out of the way, I found the Summit probably the most influential event of my career. It was great to meet so many smart people many of which I hope to keep in touch with, many of us exchanged business cards. I learnt alot from these elite passionate people and I think Microsoft did a great job which was a massive investment in the summit which proves Microsoft's commitment to the programme in which I am honored to be part of. I'd like to thank everyone at Microsoft and everyone else who helped make it a truly great experience for all of us.

Steve Ballmers keynote followed Ray Ozzies speech and ended the summit quite nicely. The guy is a great showman. You can read the keynote on the Microsoft Press site.

Just some of the mobility people I met were: Ginny Caughy, Steve Lasker, Rob Miles, Scott Holden, Chris Craft, Loke Uei Tan, Jan Yeh, Nino Benvenuti, Tony Whitter....and lots more...

I've embedded some random pictures that I took.


Taken from within the Washington State Convention and Trade Centre, downtown Seattle.


A view from my hotel room.


The Seattle Space Needle

Downtown Seattle - taken from the Space Needle.
South East view of Seattle from the Space Needle.
Random photo west Seattle somewhere.
One of the research buildings (I think 99) on Microsoft Campus, Redmond. I remember ordering a shuttle from here.
Some cool devices. HTC Advantage, HTC Shift...
The Microsoft Surface, cool.



Random building on Microsoft Campus, Redmond.

I stayed at the Seattle Grand Hyatt - highly recomended.

Monday, April 21, 2008

Databinding issues on the Compact Framework <= 2.0

I had a requirement the other day to databind an alphanumeric id - reasons for which are not that important. What is important is that setting the ValueMember property to the alaphanumeric string is fine, but setting the SelectedValue to the alphanumeric value doesn't work on Visual Studio 2005 running any version of the Compact Framework. This however does work on the desktop (2.0 - not tried 1.1).

Whats more, this seems to be fixed in Visual Studio 2008 regardless whether you target CF 2.0 or CF 3.5.

The failing code was tested on CF 2.0 SP2. The code worked on VS 2008 CF 2.0 and CF 3.5.

A simple work around that I quickly knocked up (if you are still targeting CF 2.0 with VS 2005) is illustrated as follows:-

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

List list = new List();
MyData mydata = new MyData();
mydata.Id = "1";
mydata.Desc = "Desc 1";
list.Add(mydata);

MyData mydata2 = new MyData();
mydata2.Id = "2";
mydata2.Desc = "Desc 2";
list.Add(mydata2);

//Now bind the list to our combo box.
comboBox1.DataSource = list;

comboBox1.DisplayMember = "Description";
comboBox1.ValueMember = "Id";

//DOES NOT WORK ON VS 2005 (CF 2.0) comboBox1.SelectedValue = "2";
//This does work.
comboBox1.SelectedValue = Convert.ToInt32(mydata2.Id);
}
}

public class MyData
{
private string id;
private string desc;

public string Id
{
get
{
return id;
}
set
{
id = value;
}
}

public string Description
{
get
{
return desc;
}
set
{
desc = value;
}
}
}

Friday, April 11, 2008

MVP Summit 2008

Next week I'll be attending the MVP Summit in Seattle and Redmond, WA. If you've never heard of the MVP Summit or would like to learn more, see here.

I'm really looking forward to meeting up with my fellow MVP's and the Windows Mobile and Compact Framework product teams. There are a lot of sessions in which I'll hopefully learn alot from and I'll find time to post my ramblings here. As MVP Summit attendees are under NDA (Non-disclosure agreement) I can't post direct information on products, technologies etc that arn't released yet and other confidential information, but alot of stuff, stuff that is in public domain etc, I will be able to talk about especially Silverlight for Windows Mobile....

I fly out tomorrow from Heathrow so I'll have some time to explore Seattle abit before the summit.

I hope to put faces to many names, if you're going, I'll see you there!