Embedding a database in VS Express 2013 - c#

I have found that SQL Server Compact has been discontinued and that SQL Server Express should be used instead. I have been trying to get it working but have failed so far - I need to use it the same way as SQL Server CE - i.e. to insert a local DB into my app so that the DB will be used automatically wherever my app is deployed (no installation of SQL Server etc.). But I just cannot seem to find the way.

Your looking for an embedded database.
http://en.wikipedia.org/wiki/Embedded_database
I would recommened
SQLite and its .net wrapper is here.

Related

Database application using SQL Server 2008 or any dbms

I'm developing a database application using SQL Server 2008. Since I finished my project and I thought I should see it working on another PC or friend. There is a problem in the database server it wants to connect. I want my app connects to the SQL Server every time it runs on a PC of mine, or any other's without losing any data.
I'm using Microsoft SQL Server 2008 installed. I want to use my app other pc without installing Microsft SQL Server.
If you want to make your database 'portable' you have a few options:
Use a online database service, like Microsoft Azure. You can have one central database which you can use with an internet connection;
Save the database next to the application, something like 'embedded', you can use LocalDB for that. Make sure you copy the database file along with the application.
When you want to run your application on another pc, one way is updating connectionString of DB.

How to run desktop application with its Sql Server database on a machine that have not SQL server installed

I have already finished a desktop application using Visual Studio 2010 and SQL Server 2008.
it's working perfectly on my machine (i have a SQL Server 2008 and 2005 ).
the database is local and unchangeable,
i want this application to be run successfully on the machine that doesn't have SQL Server installed.
my Connection string is:
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\KBank.mdf;Integrated Security=True;User Instance=True;Connection Timeout=300
I want to know the best and simplest way to make it. thanks
The simplest way would be to create a setup for your application that states SQL Server 2008 as a prerequisite. That's it.
For further help you would have to supply more information on how you use the database in your application and if you have a way to host a public sql server instance to which your application will connect.
If you're using the AttachDbFilename=|DataDirectory|\KBank.mdf;User Instance=True approach, then you have no choice but to install SQL Server Express (and no other edition!) locally on that / every machine that is supposed to use your application.
This approach is severly flawed in my opinion, and it limits your flexibility.
What I'd suggest is to use the real server approach: put your database onto a server (both on your development environment, and in production) and then you have the flexibility of having either a SQL Server instance on every user's machine (if that makes sense), or you can have a centralized server which the clients only connect to (no local database server installed).
If the database is "local and unchangeable" how about the compact edition? That way your clients dont need to install a full sql server instance
I agree with Nick. if you dont want to install SQL Server on the machine then SQL server compact edition would be one of the option. Syntax is pretty similar to SQL Server but it comes with limitations. like you can not have a stored procedures in compact edition and few more.
You might want to visit SQL CE Tutorial as a development resource.

Linq-to-SQL (dbml) with Local database cache (C#+VS2010)

I'm developing a WPF application, which connects MS SQL2008 database remotely.
The app communicates with the database by Linq-to-SQL. pretty handy.
However, because of the slow database server, I'm trying to use local database caching.
"VS2010 > Add Item > Local database cache" wizard could be a solution, but it uses DataSet and SQL Compact(*.sdf).
I found Linq-To-SQL cannot generate classes from the SQL COMPACT edition!
(when I drag tables, error pops up and says 'unsupported data provider')
So, is there any solution to use Linq-to-SQL with local database cache?
or is there any database sync method played with Linq-to-SQL?
If you still want to go the sql compact way, Lightspeed is a linq-to-sql provider that supports a variety of data-sources. it includes mssql compact.
http://www.mindscapehq.com/products/lightspeed
The free version is sufficient for most projects, with an 8 model/class limit.
Ive used it as a linq provider for MySql and Sql Compact before and it's been great.
You can see everything it supports and how it compares to other existing systems like it here:
http://www.mindscapehq.com/products/lightspeed/comparing-lightspeed
the Local Database Cache Wizard only supports SQL Ce on the client side. if you have SQL Express/SQL Server on the client side, you can use Sync Framework still.
see following samples/tutorials using Sync Framework:
Synchronizing SQL Server and SQL Express
Database Sync:SQL Server and SQL Express 2-Tier
nevermind if it mentions SQLExpress, the SQLSyncProvider referenced in the code should work against SQL Express,SQL Server, and SQL Azure

SQL Server database or database on SQL Server

I'm writing windows application which will be used on one computer. I like to do with SQL server, retrieve data with stored procedures, and so...
My question is, what is the difference between SQL server database (in file) and standard db on SQL server, because I don't want to install SQL server on client's PC just for one app. Can be this SQL server DB used with stored procedures, or is there other way?
Thanks.
If you don't want to install a full SQL Server engine on the client machine you could use an embedded database such as SQL Server Compact or SQLite which are designed for those scenarios.
You may want to look at SQL Server Compact, SQL Server Express or something like SQLite. I don't think any of these really offers a way to run a database engine without installing something or requiring something else to be installed (e.g. you could use AttachDbFileName method with SQL Server but this relies on VS/Express to already be there).

C# application using SQL Server database

This might sound a silly question but I've really spend hours in trying to find a solution...
I have a local database on SQL Server and it is used with a C# application.. The only way I view the database is through SQL Server.. It is accessible and altered in my application when I am running the application on my developing PC, but when I run it on another PC the database is not found (obviously) .. How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?
Initially I used SQL Server CE and I achieved portability, but I had to include stored procedures, and this edition doesn't accept them :/ so I had to turn my attention to the latter type.
Sorry for my terrible English ! :(
Thanks in advance
How can I include the database sources when I am compiling the program, (so that it would be also found when I run it on other PCs) ?
You can't. SQL Server license prohibits distributing parts of it like that, plus there is no documented way to do that. If you need SQL Server on the box, it needs to come from the installer. You can create an installer for your own product, and your installer can install SQL Server if it's needed as a prerequisite.
Alternatively, you could look at other database options such as SQLite for a file-based database. You can distribute the components of SQLite.
If you need a local sql server on each pc where your application runs then you should look into the Express edition of MS SQL Server. It is the free with limitations version of MS SQL Server.

Categories

Resources