Connecting Tech Pros Worldwide Forums | Help | Site Map

System.Data.SqlServerCe

Newbie
 
Join Date: Jan 2008
Posts: 15
#1: Jun 11 '09
Hi all,

I'm getting the following error:

The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

and it's the same for

System.Data.Common.DbCommand
System.Data.Common.DbDataAdapter



The code is using

using System.Data.SqlServerCe;

with a reference path to

C:\Program Files\Microsoft SQL Server Compact Edition\v3.1\System.Data.SqlServerCe.dll

The various database commands look like this:

SqlCeConnection conn = new SqlCeConnection(stringConnection);

This program is running on a Windows CE5 handheld and it was all fine before it was decided to upgrade from SQL Server 2005 to SQL Server 2008. I got the same errors when using 2008 so I thought that going back to 2005 would resolve them, but it's still the same. I have removed all .Net Frameworks and even re-installed version 2 but still it's the same.

I have installed:
- SQL Server 2005 with tools (Management Studio)
- SQL Server 2005 Compact 3.1
- .Net Framework 2

Does anyone know what will make this work again?

Newbie
 
Join Date: Jan 2008
Posts: 15
#2: Jun 15 '09

re: System.Data.SqlServerCe


I got this working in the end but just by using an untouched copy of VS 2005 and SQL Server 2005 on another machine. We tried upgrading the program to 2008 but that caused the following error on the handheld (Windows CE):

You are trying to access an older version of SQL Server Mobile database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe. If this is a SQL Server Mobile 3.0 or later database, run Compact/Repair. [Db version=3505053, Requested version=3004180....

We use a Resco SmartGrid in the handheld app and this was actually what was causing the problem. They have a 2005 series and now a 2009 one. 2005 obviously isn't compatible with 2008 SQL Server and VS 2008 won't recognise the control from the toolbox to add a new one but it will still compile. So because of that fact I didn't think it was an issue. 2009 works fine and it would have probably been easier just to upgrade to 2009 but it costs money and recession times makes that hard to do so we'll just make do for the moment.

I was running:
.Net Framework 3.5
VS 2008
SQL Server 2008
and with the evaluation version of the Resco MobileForms Toolkit 2009 the program was running the exact same on the handheld.

I'm not sure why I couldn't get my machine fully back to 2005 but that doesn't matter now. After spending a full day installing programs and watching progress bars I'm not going through that again ;)
Reply