Showing posts with label compact. Show all posts
Showing posts with label compact. Show all posts

Monday, March 12, 2012

Reference to Data.System.SqlServerCe in VS2005 does not install CE 2.0 to Emulator/PDA

We have a Compact Framework 1.1 application that uses Sql Server CE 2.0. In VS2003, a reference to System.Data.SqlServerCe causes the Sql Server CE dlls and Query Analyzer to install to the Emulator or PDA.

I am currently converting the application to Compact Framework 2.0, but we are not upgrading to Sql Server Mobile (yet). However, the reference to System.Data.SqlServerCe, in VS 2005, no longer causes Sql Server CE to install to the PDA/Emulator.

There is a difference in the build outputs between VS2003 & VS2005. In 2003, System_SR_enu.cab, sqlce.wce4.x86.cab & sqlce.dev.wce4.x86.cab are copied & lanuched. In 2005, only System_SR_enu.cab is copied... no launch.

Any ideas? Reinstall VS2005?

Reinstalling VS2005 resolved this issue.|||

Glad that things are working from your end. Thanks for using SQL Mobile.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

Reference not found using SQL Compact Edition

I'm currently programming a small application for Windows Mobile 5.0 and .NET Compact Frameword 2.0 including SQL Server Compact Edition.

The following code unfortunately does not for compiling.

C#-Code:

38 SqlCeEngine engine = new SqlCeEngine("Data Source = 'test.sdf'");
39 engine.CreateDatabase();
40
41 System.Data.SqlServerCe.SqlCeConnection ssceconn = new SqlCeConnection("Data Source = 'test.sdf'");
42 ssceconn.Open();

There's no more code inside the project except the standard code für a blank Form. I'm getting the following error when i try to compile:

Zeile 41: Der Typ System.Data.Common.DbConnection ist in einer Assembly, auf die nicht verwiesen wird, definiert. Fügen Sie einen Verweis zur Assembly System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 hinzu. (CS0012)

For all those who don't understand german: The Type System.Data.Common.DBConnection is in an assembly for which there isn't a reference defined. Please add a reference for System.Data, Version 2.0.0.0, Culture=....

I already have a reference on System.Data inside my project, and the version, culture and the publickeytoken are the same as required by the compiler... I'm getting really hopeless, does anybody have an idea? Thanks a lot in advance!!

By the way: My system: .NET Framework 1.1, 2.0 and 3.0 as well as .NET Compact Framework 2.0 and .NET Framework SDK v2.0. Also there is MS SQL Server Compact Edition 3.1 and SQL Server CE 3.1 SDK installed (all in german). My OS is Windows XP SP2, all updates are done and I'm using SharpDevelop 2.1.0.

You need to add a reference to the SQLCe engine (system.data.SqlServerCe) in your project. If you create a new Data Connection in the Server Explorer in Visual Studio, and use it to build a Data Source, the path of the needed DLL will be added to your project. On my system it's located at C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0\System.Data.SqlServerCe.dll.

I discuss the details of this in my EBook.

hth

|||

Thanks a lot for your answer!

I found the "error" myself, or at least a solution for this problem. It was not because of the missing reference to the system.data.SqlServerCe, because I already added this reference before and compiling didn't work. I just removed all the references from my project and added them manually, referencing not the files in the GAC but selecting them from the .net framework sdk-folder/compact framework (As I can rememember it is something like: C:\Programme\Microsoft .NET\.Net Framework SDK\Compact Framework\....). Don't ask me why it works this way, but i'm able to compile now and everything works fine. Is it possible that the versions of the referenced assemblies in the GAC are not for the compact framework?