I have created a C# project using VS 2019 which connects to LocalDb.
Any machine which has 64 bit, I install SQL Server 2016 LocalDb before running my project and after that it works fine.
Now some machines are using 32 bit operating system, so I installed SQL Server 2012 Express LocalDB.
But my project is not working and I get this error:
System.Data.SqlClient.SqlException: "A network or specific instance error occurred while establishing a connection to SQL Server. The server could not be found or is unavailable. Make sure the instance name is correct and that remote connections are allowed on SQL Server. (Provider : SQL Network Interfaces, error: 50 - A Local Database Runtime error occurred. An unexpected error occurred while calling the LocalDB instance API method. For more information about the error, see the Windows Application Event Log.
This is my connection string:
Server=(LocalDB)MSSQLLocalDB;Integrated Security=true;AttachDbFileName=D:DataTestDB.mdf
Any help would be appreciated.
Thanks
question from:
https://stackoverflow.com/questions/65557779/problem-with-connecting-to-sql-server-2012-express-localdb-in-visual-studio-2019 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…