Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

C# Interact with MSSQL DB without installing MSSQL Server

Posted on 2011-09-19
4
339 Views
Last Modified: 2012-05-12
Is it possible to use a Windows Forms application to read and write to an MSSQL mdf file without having to install MSSQL Server Express?

We are trying to deploy some software and would like to make the customer experience as smooth and lightweight as possible and having to download SQL can slow down the installation process significantly and having SQL Server running adds extra load to the low powered point of sales computers being used.
0
Comment
Question by:Dragonseer
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Minh Võ Công earned 250 total points
ID: 36564446
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 250 total points
ID: 36564577
You need SQL Server in order to use a SQL Server database. In order to be able to use the MSSQL file directly, you would have to basically rewrite part of the SQL Server code.

Sql Server Express does not require that much overhead. About 50 Mb when idle. That is less than most applications. And when you think that the main use of a point of sales computer is to run a single application...

Instead of deploying SQL Server Express however, you could use the Compact edition http://www.microsoft.com/download/en/details.aspx?id=17876. It has a smaller footprint (although I cannot say by how much) and has been designed for your type of need.

An alternative would be to use an Access 2003 database. Although it is not as powerful as SQL Server and is a little bit outdated, it is a very potent database. Access is not required to run it, the free JET database engine is sufficient.

The evangelists at Microsoft would tell you about the virtues of Azure for that type of need, but what is your opinion of cloud computing?  :-)
0
 

Author Comment

by:Dragonseer
ID: 36564619
I love cloud computing and have a fair amount of experience with it. I prefer offloading things like SQL databases to the cloud. Things are so much simpler that way.

Unfortunately, for our customers needs, we require a local database.

I've already looked into and implemented Compact.

Now I'm only have one issue with it.
I have an identity column, ID. With MSSQL Express, when I created commands for insertion, I just left out the ID column and it was auto populated which was perfect. However, with Compact it tells me that I need to supply all the columns, including the ID. However, when I do, it says that I'm not allowed to set the ID because its an identity. I can't figure how to solve this conundrum.
0
 

Author Comment

by:Dragonseer
ID: 36564638
Nevermind looks like I figured it out. MSSQL Express will accept:
 
"INSERT INTO Customers VALUES(@valueA, @valueB, @valueC, @valueD)", connection);

Open in new window


But MSSQL Compact wants:
"INSERT INTO Customers(column2, column3, column4, column5) VALUES(@firstName, @lastName, @phone, @credits)", connection);

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question