I'm wondering what's the best way to create an database application using VS C# 2010 Express Edition and I have two questions:
What should I choose Microsoft SQL Server 2008 or SQL Server Compact
3.5? 2008 seems to be more complicated to install on user's desktop. If I am right, to use Compact you only need to install this
server and after that application is just able to use database
file.
What should I include into my package, .dll file will be enough or do I need whole for example Sql Server Compact installer?
You may use LocalDB from new SQL Server 2012 Express. I thing it's ideal for desktop apps. More info at MSDN and SQL Server Express WebLog.
Just to add, might help...
I'd suggest to use NuGet to download / install EntityFramework (type it in there and you'll get a list).
You have two versions, one regular flavor and one for compact edition.
http://nuget.org/packages/EntityFramework/4.3.1
http://nuget.org/packages/entityframework.sqlservercompact
And with that you'll get a basic 'framework' for dealing with databases as well (you'd need just to install the SqlCE (suggest 4 as is newest)) - NuGet installs the dll-s needed.
You can use 'model first' approach with EF (entity framework) to create Db first,
or even better use 'code first' approach - to create Db automatically from your code, classes.
That'd take care of creating new Db etc.
I think that's the easiest way to 'start up' with a new Db. And CE as well.
CE (compact) is a good choice - but watch, it has certain limitations comparing to the standard server SQL (express or standard etc.). E.g. you cannot use I think xml fields, and some other things, stored procedures, views etc. (If I'm correct and remember from before).
Also depends on what you want to make and where to deploy. Desktop doesn't mean that CE is best solution (depends on many details).
hope this helps
MSDN has some documentation on how to deploy SQL Server Compact with your app. It's indeed possible to both install it separately, or bundle it with your application, which is probably what you want.
Related
HI, I'm trying to create a simple database for my C# .NET application. It's easy enough to create a db and to run it locally, but I was wondering which is the best free one I should Use? Furthermore, I would also like the application to be easily deployable on multiple PCs (each with their own local db instance). What is the best tool for me to use?
SQLite is very popular.
http://www.sqlite.org/
I would also add they have fantastic support across many platforms and uses:
http://www.sqlite.org/whentouse.html
Take a look at the latest SQL Server Compact Edition. It's designed to be embedded so you can easily deploy with the right files added to your install / copy setup.
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0d2357ea-324f-46fd-88fc-7364c80e4fdb&displaylang=en
Postgres if you need this to be a serious solution, SQLite if it's a lightweight concern.
For my money, Nhibernate support is the important question.
If you're using .Net, why not use SQL Server Express Edition?
The Microsoft answer is SQL Server CE (Compact Edition): http://www.microsoft.com/sqlserver/2005/en/us/compact.aspx
There is an isntaller, but it can also be deployed just by including a few DLLs.
The obvious answer should be the express edition of SQL Server :
http://www.microsoft.com/express/Database/
Personally I just use microsoft access most of the time for simple stuff.
Note that may users are suggesting SQL Server Compact Edition. It could be useful to know the difference. CE is much more limited, but easier to deploy. Sounds like CE is the better choice for your application.
I am working on WPF application, and now I have to choose which database to use. It will be local database.
I am thinking about SQLite, but I am not sure. I am not sure how much data my database will contain, maybe a lot, it depends on users use of application. In that case maybe SQLite is not good solution.
Maybe it is best solution to get use Microsoft SQL Server Express.
I would choose the MSSQL Express Edition because its the most well intergrated with .Net. And if you need to upgrade to Standard Edition its fully compatible you just upgrade it without change anything.
I recommend Microsoft SQL Server Compact Edition.
If you want to go with open source databases to cut down the cost MySQL is the ideal solution. it's competent to the MSSQL Server and one of the top most open source databases.
i have just started using visual studio 2008.I am working on c#.
I want to add SQL database particularly LOCAL database (.sdf) to my project and want to use queries which will save data in database and fetch some data from database and which will display and will perform different function.
So, if any body can give me any small tutorial or link that what are various types of databases i can use along with visual studio and and how will i be able to use it.
Any general tutorial will do.
Thanks a lot.
Regards,
Don't use .sdf databases.
I've worked with it but it was confusing. I was not able to use WHERE statements....
Use SQLite instead.
That is THE Solution.
Download SQLite here
Another tutorial
I recommend you the use of SQLite
Not sure why Gergen was unable to perform where statements. One issue I had with Compact edition was that I couldn't create stored procs or views. I don't have much experience with SQL Lite, so I can't give an opinion on that.
If you are doing web based stuff (i.e., asp.net), I found the following series a good introduction to database stuff: Data Access Tutorials
As for what database to use, as long as there's a provider for it, working with it via ADO.NET (or entity framework, or whatever) should be similar. If you are just starting, I'd probably recommend staying with the Compact Edition since most examples/tutorials you'll see will involved SQL Server.
For simple Local SQL database stores, there are quite a few solutions. A good full comparison can be found on from Wikipedia
SQL Express 2008
Out of process, runs as a windows service, supports stored procedures and views and does pretty much everything SQL standard does with few limitations. 50MB install.
Ideal for anything but large SQL deployments.
Loads of how to guides for SQL Express
SQL Compact Edition 3.5 (.sdf files)
In process, the code for accessing the database runs within the same process as your application. Ideal for embedded systems (point of sale, ATM, in-car systems etc...). Microsoft's equivilent to SQLite. Very small install (easy to deploy with app).
Getting started guide for SQL Compact Edition and a load of HowTos to get you going
SQLite
The non-Microsoft answer to an in process database. Pretty much the same functionality as SQL Compact Edition apart from it's a smaller install (300kb for SQLite vs. 2MB for SQL Compact edition), it supports larger database files (32TB for SQLite vs. 4GB for SQL Compact edition).
SQLite getting started article
Connecting to Microsoft SQL Server 2008 from Microsoft Visual Studio 2005 and 2008
http://msdn.microsoft.com/en-us/library/s4yys16a(VS.71).aspx
I've never built anything using SQL Lite so I can't say much for it. I have, however, built several commercial applications using Compact Edition and haven't had any serious issues.
You can't batch commands with CE and the syntax is the same as Sql Server (with many missing features, but the most commonly used features are there and I've never had a problem without a work around of some sort).
I've really only used it as an "offline" database in an application for a company that dispatches repair technicians. The applications run on netbooks and download their data from a MySql database whenever mobile connectivity is available so they still have access to their work when they have no mobile coverage.
Due to it being so similar to SQL Server, Compact Edition would probably be an easier starting point. Since you're using a local database file you probably won't hit the 4GB limit (with very little pruning my mobile databases rarely exceed 20MB) - and if you ARE hitting that limit you may want to consider using a service based database (like Express) instead.
I need a lightweight database engine for a desktop application. The application is not data centric, although it needs some persistent data. Which one would you use MS SQL Server express edition or SQLite?
EDIT
Is SQL Server Compact edition free? If it is the case, what about SQLite vs SQL Server Compact edition to develop this kind of application?
Definitely NOT Sql Server Express. That's a server class engine. You want an in-process engine. In that regard, SQLite is fine. So is Sql Server Compact Edition. Both are free and either should be adequate for your needs.
If you're working with C# and Visual Studio simply right-click on your project and select "Add Item..." and in the dialog select the "Local database", this will create a SQL CE (Compact Edition) database. It's got most of the functionality of SQL Express/Server as far as tables, data types, views but doesn't allow stored procs. It also works with Linq-to-SQL so it's a snap to integrate.
Go with SQL Server Compact - you get to use LINQ that way, which itself is worth the effort.
While SQLite is an option, you'll need to get an ORM layer, and the performance gain will be minimal / non-existent compared to SQL Server.
Firebird is a well known database and support the latest Microsoft framework
SQLite, especially if it's single-user. One data file and one DLL.
If its a single user system you want to look at MS SQL Server compact edition not Express (see here: http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx )
Compact Edition is an embedable database similar to SQLite.
Unfortunately I can't make a recommendation either way.
What about MS SQL Server Compact?
Some love for one of the up and comers in the .NET embedded db world -- VistaDb. The license is a bit more restrictive than Sql Server Compact (free to single developers only), but its a 100% managed DB with xcopy deployment and has VS tool integration.
Be aware that if you use SQL CE along with EF, you will have to generate your own id key, because SQL CE does not support multiple query.
i.e:
insert -> select key for the entity -> not good
generate and id key (GUID or something else) add it to your entity and then insert -> good
Defo SQL lite, although it has some restrictions/features that you should be aware of
if your need is data centric, what you really need is a file, if you need transaction (ACID) then your need is (rdbms) database.
Otherwise you'll have issues when up scaling.
If it's not a lot of data, and you don't need to run complicated queries (although LINQ can), why not use an XML Dataset? That way it's platform independent (could run on Linux with Mono) and doesn't require the user to install extra resource hogging software.
I use XML Datasets extensively for applications that require persistent data storage of small amounts of information. If it's only a few variables, you can also use a settings file, and it will be stored either per application or per user depending on your choices.
Think about overhead for your end users ... SQL Server Express still takes up resources, takes time to start up on a reboot and so on. For a small amount of single-user persistent data I would go with SQLite. Unless you're doing serious binding and so on you won't need an ORM between you and it.
I'm going to be writing a Windows application using the .NET framework and C#. The application will need to store relational data which will be queried, joined and processed.
Previously I've done this using SQL Server, but that is a total overkill for the application I am now making.
What's the simplest, easiest way to store relational data in my application? If I was on a Mac, I'd be using SQLite. What's the .NET equivalent?
If you are using VS 2008 and .NET 3.5, you can use SQL Server Compact Edition. It's not really a server at all, it runs in-proc with your app and provides a basic SQL database. The databases themselves are a single .sdf file and are deployed with your app. Since it's part of the framework, it also means there's no additional installation. Actually, It's not actually part of the framework, but it's easily redistributable. I'm using SQL Server CE for a personal project I'm currently working on, and it's turned out great so far.
SQL Server Express is what you want. It's free IIRC and easily scales into full-blown SQL Server when required.
Why cant you use SQLite? It works on windows.
SQLite Quick start.
Also see here for getting it to work with .NET http://web.archive.org/web/20100208133236/http://www.mikeduncan.com/sqlite-on-dotnet-in-3-mins/
So you could use SQLite if you wanted to but perhaps as others have pointed out SQL Express is a better option as you can upgrade to a full server if you need to in the future. Although from what you wrote i don't know if that's likely.
Sqlite is definitely the best option for embedded database for application storage.
It is free fast and reliable.
Sql Server Compact Edition (*.sdf files). Small enough for Smartphones but also available on the full platform. The .net 2 version was called Sql Server Mobile.
Here is a comparison between Compact and Express.
I haven't used it yet but if I was making a windows application and needed functionality similar to this I would use the built in windows database that's already on every single box of windows.
http://www.codeplex.com/ManagedEsent
You can use SQL Lite with .NET. In fact, if you are willing to keep your code so it can translate to mono, which encompasses most 2.0 (3.5 still upcoming), you can run your code on the Mac, as well, if you stick with SQL Lite:
http://mono-project.com/Main_Page
It really depends on how much bang you need. SQL Express, which has been mentioned numerous times in this thread, is SQL Server. It has some restrictions over full blown SQL Server, but it is the full SQL Server engine, so it is not a lite version, unless you think restricting a database to 4 GB makes it light. If you need heavier services like some Reporting, some message queueing (service broker), then SQL Express 2008 is your creature.
For lighter in the MS world, you can go with SQL Compact. As with SQL Lite, it is limited in scope, but you stated you need a lightweight database.
If you are really familiar with SQL Lite, I see no reason not to head that direction. Add a factory on top of your database access, just in case you change your mind. Then you will not have to rip up your entire app to switch databases.
Microsoft JET Blue.
If not sqlserver express, You may want to conisder Microsoft SQL Server Desktop Engine ( scaled down version of sqlserver) which is free in most cases. or MySQL which is also free. I'prefer mysql.
SQLite
Firebird
MySQL Embedded
I would say Microsoft Access. You need a licence though ...