16

I have designed an accounts software for my clients. I used SQL Server 2008 database with Stored Procedures. It is developed in Visual Studio 2010, .NET Framework 3.0. I have more than 500 clients using Windows 7.

The major problem is:

Is SQL Server runtime automatically installed with .NET Framework? As MS Access database does not required Office to be installed on client.

I can not installed SQL Server 2008 on each client, it is a tough job. Also the clients are not having a good knowledge of installation process.

How to run SQL Server database on clients without installing its setup on clients? Is there any runtime files or setup?

11
  • 1
    You can create a set up project and mark sql server express and dotnet framework as a prerequisite . Oct 5, 2015 at 19:19
  • 1
    Dot net framework is already installed on their system. because its a part of windows 7. But how can client download and install sql server ?? They reject my software and use some other other one, Just because of database. Oct 5, 2015 at 19:22
  • 1
    Is there any small and easy way to install sql server, so that client can easily install them ? Oct 5, 2015 at 19:24
  • 1
    Search for SQL Server 2016 Express LocalDB. I assume you want an SQL Server running on a local PC not shared with other PCs on a LAN.
    – rheitzman
    Oct 5, 2015 at 19:28
  • 1
    Have u tried SQLLite or Compact SQL. SQL server may be heavy weight for you kinda application. Oct 5, 2015 at 19:30

3 Answers 3

23

Option 1 - Setup Project

Using Visual Studio you can create a setup project and install prerequisites that you need during installation.

The installation process is very simple and the end user can install application and prerequisites after clicking next buttons.

Here are the steps for Creating a Setup Project:

1- Create a c# Windows Forms Application

  1. Create a C# Windows Forms Project
  2. Add New Item and Add SQL Server Database to your application
  3. Add a table to your application and fill some data in it
  4. Show the data in your main form.

2- Create a Setup Project

  1. Add new project → setup and deployment → setup project
  2. Right Click on Setup project and Add project Output and select primary output from your main project
  3. Right Click on Setup project and Add project Output and select content files from your main project
  4. Right CLick on setup project and Click Properties and click Prerequisites and select SQL Server Express
  5. Select .Net Framework
  6. Select Windows Installer
  7. Select radio button Download prerequisites from the same location as my application.
  8. Right Click on Users Desktop at left pane and add new Shortcut and select application folder, primary output from SampleApplication, and click ok and the rename the short cut to what you need.
  9. Rebuild solution.
  10. Rebuild Setup Project
  11. Go to Output directory of setup project and run setup.exe

It's that easy.

For more information take a look at following docs articles:

  1. How to: Create or Add a Setup Project
  2. How to: Install Prerequisites in Windows Installer Deployment
  3. Walkthrough: Using a Custom Action to Create a Database at Installation

Option 2 - ClickOnce

Using Visual Studio another option is using ClickOnce publishing.

To do so, in properties of your project, in publish tab, click prerequisites button, you can select SQL Express in prerequisites. This way, you only need to set your database files to copy in output directory, and use AttachDbFileName in connection string: Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\Database.mdf; Initial Catalog=Master".
For more information take a look at the following docs article:

21
  • 1
    Clients may deny to use the software because of its larger size setup. Oct 5, 2015 at 19:59
  • 1
    @ArtandArtisticartandartisti Clients should accept your set up or install prerequisites themselves :) Oct 5, 2015 at 20:02
  • 2
    They can not install prerequisites themselves. Think of you, Will you install a software that requires a lot of Next, Next, Select, Next etc. Clients need a software that compact in size an quiet easy to install without having technical knowledge. Oct 5, 2015 at 20:14
  • 2
    @ArtandArtisticartandartisti You should know each method you use to deploy your database in client will result in sql server installation, no difference between size :) Oct 5, 2015 at 20:18
  • 4
    @ArtandArtisticartandartisti anyway, I am here to help you and these options was the best things that came to my mind. Hope these options help you to overcome the problem and you can install your application on clients :) Oct 5, 2015 at 20:20
5

LocalDB is Microsoft's current recommended solution. It allows you to connect to a database file directly, without having to install an instance of the Full SQL Server, or SqlExpress. It is fully compatible with the full version of SQL server. There are no installation requirements on the client end, as the libraries are packages along with your application when it is built.

You can read more about it here.

9
  • 1
    OP is using Visual Studio 2010 and .Net Framewrok 3.0 and SQL Server 2008. Oct 5, 2015 at 19:40
  • 1
    Can we protect it with password as SQLCE and MsAcces. So that client's Financial information can be secured ? Oct 5, 2015 at 19:44
  • 1
    Yes, the password can be embedded in the application and passed in the connection string, Be aware that I'm currently researching whether this solution can even be used with the 3.5 framework based on Reza Aghaei's comment, this might not be an option for you. Oct 5, 2015 at 19:46
  • 1
    This Stackoverflow question seems to indicate that LocalDb CAN be used with the 3.5 framework, however installation may be more complex. stackoverflow.com/questions/24527528/… Oct 5, 2015 at 19:50
  • 2
    How can i attach password to the database. Because mdf file will be on user machine and He/She can easily see my logics and tables. Is there any way to protect it ? Oct 6, 2015 at 11:45
2

you can instal sql express With silent installation in your setup this way not showing any wizard for install sql express Read this Link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.