Solved

C# Interact with MSSQL DB without installing MSSQL Server

Posted on 2011-09-19
4
341 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
[X]
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
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

730 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