Question

I am new to C# and SQL Server databases, so this may be a stupid question but I am confused.

I want to setup an embedded database on a client machine automatically when he installs my application. I know SQL Server Compact Edition is there but there are so many restrictions in SQL Server CE.

Can I use .mdf files as an embedded database? If yes then how can I setup it on client machine automatically? or is there any other option to solve my problem?

Était-ce utile?

La solution

I would recommended to use SQLite. It is simpler to deploy. Also, SQL Server Compact appears to be discontinued.

Is SQL Server Compact discontinued from Visual Studio 2013?

You can use SQLite which doesn't require any installation on the client machine.

SQLite depends on the Visual C++ runtime, but you don't need to install it on the client machine. The system.data.sqlite download page contains several "static" packages that already contain the runtime.

All the "static" packages contain either native or mixed-mode assembly binaries linked statically to the appropriate version of the Visual C++ runtime. Typically, these packages are used in cases where customer machines may not have the necessary version of the Visual C++ runtime installed and it cannot be installed due to limited privileges.

For example, on my machine I am running Windows 8.1 x64 so I went under Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0) and downloaded sqlite-netFx40-static-binary-x64-2010-1.0.90.0.zip.

This binary package contains all the binaries for the x64 version of the System.Data.SQLite 1.0.90.0 (3.8.2) package. The Visual C++ 2010 SP1 runtime for x64 is statically linked. The .NET Framework 4.0 is required.

I then unzipped the package and ran test.exe to make sure everything works. Zero installation required.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top