Problem using SqlServerCe in .Net 4.0 - c#

SqlServerCe doesn't seem be supported in .net 4.0. But since I needed an embedded database in my application, I gathered all the necessary 3.5 dlls and included them so that my wpf application could use SqlServerCe as its embedded database.
The application works on my development machine, but now that I've created an installer, and am installing the application on other machines, I keep getting this exception on hose machines:
Unable to load DLL 'sqlceme35.dll': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
That dll is definitely included in directory where the application is installed. I've even tried copying all related SqlServerCE dlls to the System 32 folder. Nothing I've tried so far has resolved the problem.
Any suggestions?

I just recompiled an app I have that uses SQL Server CE 3.5.1 in .NET 4.0 and it works just fine. Here are a few things to check:
Are you including all of the SQL
Server CE DLLs in your installer?
There are 7, not just 1. The others are native DLLs which are the actual core of SQL Server CE.
SQL
Server CE has x86 and x64 version
DLLs. Are you using the correct
version for the OS you are
installing on?

I resolved my problem by installing:
Microsoft SQL Server Compact 3.5 Service Pack 2 Beta 2 for Windows Desktop:

I solved the problem by installing the Microsoft Visual C++ 2008 Redistributable Package (x86)

In my case the Microsoft.VC90.CRT.manifest from \bin\amd64\Microsoft.VC90.CRT respectively \bin\x86\Microsoft.VC90.CRT was missing. When deploying your solution, it isn't part of the release by default but on some servers it seems to be necessary.

Related

unable to install or run C# application on client PC

I have developed a desktop application in c# & SQL server 2012 using Visual Studio 2013. I have included the reference for Microsoft.VisualStudio.DebuggerVisualizers and set copy local : true.
The application runs perfectly on client systems with windows 8, 10.
But its showing this error while installing on a windows 7 system.
- OS Windows 7 Ultimate
- already installed .NET Framework 4.5
- installed Report Viewer.exe 2012
- installed report viewer.msi 2010
- installed sqlclr types
- the system doesnt have any microsoft c++ redistributable , i am not sure whether it has any impact.
I checked in the assembly folder, but couldnt find the Microsoft.VisualStudio.DebuggerVisualizers.dll
Am I missing any prerequisites here? How to solve this issue so that i can install the application
Error Message
It needs the Microsoft.VisualStudio.DebuggerVisualizers.dll in the global assembly cache. The GAC is the area where libs are placed which can be accessed from all of the system.
It's kinda a ugly fix but you could place this lib in the same or subdirectory of the same directory where the application is.
Is it possibly that you haven't installed VS on that Win7 machine but on the others?
Unintentionally the Microsoft.VisualStudio.DebuggerVisualizers.dll had been included in the project reference. And in the client system the specified dll could not be found even after trying to install it. Hence I removed it from reference and then it worked perfectly fine without any issues. I guess instead of report visualizer i have included debuggervisualizer. It was a manual error.
Thank you for your support

Cannot load SQLite DLL on Windows 7 32bit PC

I've currently used the System.Data.SQLite DLL in a .NET 4.0 x86 WinForms app. This is causing an issue on one of my client's PCs although I cannot reproduce this bug on my system. Both systems are 32bit Windows 7. How do I solve this? Things I've tried:
Installing .NET 4.0 (the app is .NET 4)
Installing all possible VC++ Runtime versions from 2005 to 2012
Installing this particular VC++ Runtime that SQLite needs (fixed a similar issue on my PC)
Adding the useLegacyRuntime attribute in the app.config XML
The error looks wierd because my app is obfuscated. The app works on my 32-bit PC and on my 64-bit development PC. It fails on a client machine. What can I do to solve this error?
In your project, solution explorer expands the Reference section and right click System.Data.SQLite then open properties, in the properties window, make sure copy local is set true . After that rebuild your project and run your client machine again
Turns out my SQLite DLL was outdated. I downloaded the latest from here and rebuilt my app with it. It worked on my PC as well as the client's. I had to install VC++ Runtime 2005 x32 on the Client Machine as well.

How to properly resolve Can't find PInvoke DLL 'sqlceme35.dll'

Disclaimer: I am a total noob when it comes to anything .Net, but I have to get stuck in for a project I'm working on.
I see there are already some posts on this here, but no complete answer on how to resolve this. I get this warning:
Can't find PInvoke DLL 'sqlceme35.dll'
when trying to deploy to a Windows Mobile 6.5.3 emulator from Visual Studio (I'm coding in C#). I am obviously using Sql Server CE for the application. I see it deploys just fine to emulators running older versions of Windows Mobile (namely 5.0).
Could anybody please explain this?
sqlceme35.dll is not part of a standard Windows Mobile SDK installation and needs to be installed separately (see https://www.microsoft.com/en-us/download/details.aspx?id=8831) and deployed manually (copy and install CAB file from your PC after install, see https://msdn.microsoft.com/en-us/library/13kw2t64%28v=vs.90%29.aspx).
In your case you need to install the cab files from the wce500 subdirectory. ( "drive:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\wce400 or wce500\CPU architecture type").
Although the site https://technet.microsoft.com/en-us/library/ms172361%28v=sql.105%29.aspx states that SQL Server CE runtimes will be deployed automatically, this is not always the case. So best is to manually install the runtimes before running an app that depends on them.
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i
Get the following cab files:
sqlce.wce5.armv4i.CAB
sqlce.repl.ppc.wce5.armv4i.CAB
sqlce.ppc.wce5.armv4i.CAB
sqlce.dev.ENU.wce5.armv4i.CAB
Install those onto the Program files directory of your pocket pc. Once they are installed, you will then see a folder called "Microsoft SQL Server Compact Edition". It will have the dlls that your application uses.

C# to ms access database

I got an shown in the below image on my connection between my ms access database and my c# windows form application,error says that
"The 'Microsoft.ACE.OLDB.12.0' is not registered to local machine"
visual studio2015 and ms access2016
i'm an amateur
Having recently dealt with this myself, I believe you need the Microsoft Access Database Engine 2010 Redistributable https://www.microsoft.com/en-us/download/details.aspx?id=13255
You have two options:
32-bit version (AccessDatabaseEngine.exe)
64-bit version (AccessDatabaseEngine_x64.exe)
You cannot install both at once. If you are targeting for the x86 platform, install the 32-bit version. If you are targeting for the x64 platform or AnyCPU, install the 64-bit version.
Have you installed office 2016 data connectivity components? If not please install the same. You could get more details on the below links
Stack Overflow link

Deploying application using SQL CE 4.0 to work both in 32 and 64 bit PC

I am planning to create an application which uses SQL CE 4.0. I saw like there are two types of deployment central and private. So now i am planning to use private deployment. So all the dll must be included in the project as explained here.
But I tried just adding all dll from my XP PC(32 bit) and not added any 64 bit dlls(but it was mentioned to add 64 bit dlls). Then i set platform to x86. After building application i tried running my application in a 64 bit PC and it worked properly. I was expecting it would give error as i have not included 64 bit dlls.
So the reason for proper working in 64 bit pc is due to x86 platform which I have set? Also can I use same method to deploy application and give it to my customers(instead of using 32 bit and 64 bit dll separately)?
EDIT:
In a windows XP PC i installed only .net 2.0 and then run my application which has sql ce 4.0 SP1 private deployment and it worked fine.
Then i tested central deployment(no dlls in application path) in same pc after installing sql ce 4.0 sp1 , while running application I got error like
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Then i uninstalled sql ce 4.0 sp1 and then installed sql ce 4.0 (without sp1) and now central deployment application worked!! So what is the problem actually?
In SQL CE 4.0 download page it's mentioned like .net 3.5 SP1 is the minimum requirement. So does private deployment works only with .net 2.0?Also why i got error for central deployment with sql ce 4.0 sp1?
Yes, forcing x86 is a good and simple approach, and will eork well on both desktop platforms

Categories