Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2016 LocalDb connection issue

I created an application with a .mdf database file (version 13.00.4001).

If I run application on the same computer where I have compiled it, everything works great. But if I try to run it on a second computer with SQL Server LocalDb 2016 installed, it doesn't work and says that SQL Server cannot be found on computer.

What's the problem? I can't understand why.

And if I try to run application on a PC where there is installed SQL Server 2014 LocalDB and 2016 the log says

cannot be opened because it is version 852. This server supports version 782 and earlier. A downgrade path is not supported

Really I can't understand why there are all these problems.

Code used to build connection string:

"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + 
Directory.GetCurrentDirectory() + 
@"\Dati.mdf; Integrated Security=True"
like image 412
Mirko Fogazzi Avatar asked Oct 18 '22 15:10

Mirko Fogazzi


1 Answers

I Solved my problem by deleting existing MSSQLLocalDB instance and re-create it with this command line

sqllocaldb delete MSSQLLocalDB

and

sqllocaldb create MSSQLLocalDB

and now all works great.

like image 147
Mirko Fogazzi Avatar answered Oct 20 '22 11:10

Mirko Fogazzi