Reputation: 65
We have a windows form application with a local .mdf database. It has all its required functionality, but it wont work without connecting to the associated database. This is probably an incredibly simple solution, but we cannot figure out WHAT needs to be installed on the target PC for this to work. For reference, our connection string is as follows
const string connectionString = "Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = |DataDirectory|ourDataBaseName.mdf; Integrated Security = True";
The problem is, this, and the published program version, works fine on OUR computers, but with our test computer, we cannot for the life of us get this thing working. My questions then are the following
For reference, the database and program were made in visual studio 2015, and does not integrate with any other applications, and is intended for use on a single pc. Aside from installation, it shouldn't need connection to the internet to function.
Any help or direction to helpful resources would be greatly appreciated.
Thanks
Upvotes: 2
Views: 971
Reputation: 11
I had exactly the same problem, I had an application with a local database, which was created in sql server 2017, and when I published it, it only worked on my PC and nobody elses. After struggling a long time to solve this I found out that I needed to install both SQL Server Express 2017 AND the localdb version on the target device. Keep in mind that even after installation and rebooting the machine, MSSQL Service has a tendency to not be running and you'll face the same error, you'll have to start it manually.
Upvotes: 1