Solved

C# Interact with MSSQL DB without installing MSSQL Server

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Select2 jquery help 9 46
need help with extracting google+ term from the string 7 21
Close word object 13 24
Stored Procedure 2 10
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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

744 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

11 Experts available now in Live!

Get 1:1 Help Now