SQL Server Forum / DB Engine / SQL Server CE / July 2008
SQL CE v3.5 error referencing
|
|
Thread rating:  |
Carlos - 15 Feb 2008 02:12 GMT Hi all, for this line of code,
public SqlCeConnection conn = null;
I get the following error when trying to connect to a SQL CE v3.5
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'.
c:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll: (Related file)
Does someone knows what is it about? Tahnks,
Carlos.
Ginny Caughey [MVP] - 15 Feb 2008 12:16 GMT Carlos,
You're writing a desktop app, right? Do you have a reference to System.Data?
 Signature Ginny Caughey Device Application Development MVP
www.wasteworks.com Scalehouse and Billing Software for Waste Management
> Hi all, for this line of code, > [quoted text clipped - 12 lines] > > Carlos. Carlos - 15 Feb 2008 14:37 GMT Hi Ginnny,
no, I am writing an app for a smart device using VS 2008.. I am able to add the data source as SQL server compact v3.5 targeting the .Net compact framework v3.5. I add the right sqlserverce reference which resides under the v3.5 directory. However for some reason it complains about the assembly
Any help would be greatly appreciated!
Carlos.
> Carlos, > [quoted text clipped - 17 lines] >> >> Carlos. Ginny Caughey [MVP] - 15 Feb 2008 15:05 GMT Carlos,
It sounds like you have a reference to the desktop SQL Compact and not the device one. This is the path on my machine: C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll. Note the Devices folder instead of Desktop.
 Signature Ginny Caughey Device Application Development MVP
www.wasteworks.com Scalehouse and Billing Software for Waste Management
> Hi Ginnny, > [quoted text clipped - 30 lines] >>> >>> Carlos. Carlos - 15 Feb 2008 15:59 GMT Hi again Ginny,
hey, thank you for your prompt response! Silly me, I was thinking that I pointed to the right version. But, I thought they were generic so I did really did not pay attention..
I created a bare bones new project referencing the right path, and this time I justy got a warning mentioning the same issue. i.e.:
Consider app.config remapping of assembly "System.Data, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "2.0.0.0" [] to Version "3.5.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "2.0.0.0" [] to Version "3.5.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.dll] to solve conflict and get rid of warning.
According to the reference properties, those 2 references : System.dll, and System.Data.dll are obtained from those directories. Their runtime version is v2.0.50727, and the version is 3.5.0.0. So I do not know where is the confusion.
Thanks again!
Carlos.
> Carlos, > [quoted text clipped - 38 lines] >>>> >>>> Carlos. Ginny Caughey [MVP] - 15 Feb 2008 16:32 GMT Carlos,
Are you intentionally targeting CF 2.0 instead of 3.5 for your project? If I use the Smart Device template to generate a project, the default CF version is 3.5 and this is the reference to System.Data:
C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll
 Signature Ginny Caughey Device Application Development MVP
www.wasteworks.com Scalehouse and Billing Software for Waste Management
> Hi again Ginny, > [quoted text clipped - 70 lines] >>>>> >>>>> Carlos. Carlos - 15 Feb 2008 16:44 GMT Ginny,
nope, the target was CF3.5, and the properties of the namespaces that appear by default in the project point to the:
C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\
directory. That is why I do not understand the warning.
Carlos.
> Carlos, > [quoted text clipped - 79 lines] >>>>>> >>>>>> Carlos. Ginny Caughey [MVP] - 15 Feb 2008 17:38 GMT Carlos,
Neither do I. I think at this point since you did have the incorrect desktop reference at one point, it might be easiest to just start a new Smart Device project, add the right reference to SQLce, then bring in your source files from the existing project.
 Signature Ginny Caughey Device Application Development MVP
www.wasteworks.com Scalehouse and Billing Software for Waste Management
> Ginny, > [quoted text clipped - 90 lines] >>>>>>> >>>>>>> Carlos. Carlos - 15 Feb 2008 18:41 GMT Giiny,
Thank you very much for your very valuable help. I really do appreciate it. I'll do that.
Take care,
Carlos.
> Carlos, > [quoted text clipped - 97 lines] >>>>>>>> >>>>>>>> Carlos. Carlos - 15 Feb 2008 19:00 GMT Ginny,
FYI. After creating a brand new project, and using the right reference, I still get the warning. However, the build output at the end ignores it and displays 0 warnings..! Is it because it is just something to consider so that the conflict can be avoided? The way that I see it, there should not be anyy conflict in the first place..
Best regards,
Carlos.
> Giiny, > [quoted text clipped - 106 lines] >>>>>>>>> >>>>>>>>> Carlos. Ginny Caughey [MVP] - 15 Feb 2008 19:08 GMT Carlos,
I don't know why you get the conflict warning initially either since I don't see it on my setup.
 Signature Ginny Caughey Device Application Development MVP
www.wasteworks.com Scalehouse and Billing Software for Waste Management
> Ginny, > [quoted text clipped - 121 lines] >>>>>>>>>> >>>>>>>>>> Carlos. Brian Weikel - 05 Jun 2008 18:35 GMT Instead of 'System.Data.Common.DbConnection', you might try 'System.Data.SqlServerCe'. Just a thought...
Sergey Zwezdin [C# MVP] - 24 Jul 2008 10:18 GMT what about?
 Signature Sergey Zwezdin | Chelyabinsk, Russia | Microsoft MVP | icq: 30655536 | sergey.zwezdin@gmail.com
> > Instead of 'System.Data.Common.DbConnection', you might try > 'System.Data.SqlServerCe'. Just a thought... > > *** Sent via Developersdex http://www.developersdex.com ***
|
|
|