Wednesday, March 7, 2012

possible to connect to SQL Server Mobile database

Is it possible to have a Windows applications (based on .NET Framework 2.0) connect to a SQL Server Mobile database?

I manually added the the System.Data.SqlServerCe.dll (retrieved from C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\\SQL Server\Mobile\v3.0\System.Data.SqlServerCe.dll) to my Windows Form project. When I start the app, it gives me an error message:

{"Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"}

TIA

K. I got this to work.

My problem was that I did not reference the dll from the correct location. The correct location of the SqlServerCe dll to reference is "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\System.Data.SqlServerCe.dll"

|||

Thank god i found this, i tried what was said in

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=284483&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=367019&SiteID=1

that didnt work for we, some how it worked for other ppl it seems.

anyway, Thanks

|||

Dear Stormin,

I took the dll from the right location as you specified. But now I get another error Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).

|||

Hi all,

I have been searching for weeks now trying to solve the same problem. I wrote a desktop application- and I waqnt this desktop application to access a sdf database. The correct system.data.SqlServerCe.dll is correctly referenced and it still gives me a "Unable to load DLL 'sqlceme30.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" error. If I can open the database from within the Dev environment and edit it from there, why can no one come up with a solution to this problem?

|||Have you installed the SQL CE runtime components on the machine? Have you tried to include all the SQL CE dlls with your app?|||

Copy all seven sqlce...dll files from C:\Program Files\Microsoft Visual Studio 8\Common7\IDE over to SYSTEM32 folder. This solved the problem for me. Check out the following link for details.

http://blogs.msdn.com/smartclientdata/archive/2005/07/15/439008.aspx

No comments:

Post a Comment