Solved

C# Interact with MSSQL DB without installing MSSQL Server

Posted on 2011-09-19
4
336 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now