-1

I’ve built an application with a local .mdf database, and I’ve deployed the app. I tested it on my PC; there were no problems. The application works perfectly. Today, I installed the app on a client’s PC, and I got this error:

enter image description here

Although all the files are in place and SQL Server 2016 installed on my client’s PC.

Daniil T.
  • 1,145
  • 2
  • 13
  • 33
  • 1
    Did you at least do what message says? – Selvin Nov 09 '19 at 15:39
  • Welcome to Stack Overflow! Share your code, exception detail and please review [how-to-ask](https://stackoverflow.com/help/how-to-ask) to help you to ask a good question, and thus get a good answer. – Selim Yildiz Nov 09 '19 at 15:45
  • You need to install [localdb](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15) on client's machine. The error message says that the localdb is not installed or the service is not running. – Mat J Nov 09 '19 at 16:06
  • If I remember right, data tools options on the Visual Studio installation will add local DB to the computer. Was that option chosen upon installation? – Antoine Hernandez Nov 09 '19 at 18:29
  • @AntoineHernandez I’ve checked the box saying, SQL Server 2012 LocalDB and the 2012 one was the only option available. – Vernauz Nov 09 '19 at 20:38
  • I got the option wrong, it was Data Storage and Processing. That installs the SQL Server Data Tools components, which includes a localized SQL Server instance. Regardless of that, check the connection string in the application to make sure it’s pointed to the proper location. – Antoine Hernandez Nov 09 '19 at 20:51

1 Answers1

1

I can think of two reasons:

  1. You either used a fixed source path like:
c:\MyProgram\database.mdf

So if you move the database somewhere else other than that folder, simply it won't work because it won't be able to find Database file.

Solution: use a dynamic location, so no matter where the app is installed, it should find your DB.

  1. the installed SQL Server is not the same version or higher as your DB, or not installed properly.

Solution: reinstall or repair SQL Server.

Shekar Kola
  • 1,287
  • 9
  • 15
Adnan
  • 186
  • 2
  • 8