LocalDB deployment on client's machine

0

I have created a setup file for a WPF application with Database in MDF format and I'm trying to test the application and to connect it to the attached database, but I'm still getting this error :

Error on Connection settings System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'admin'.

Error Number :18456,State :1,Class :14

And this my connection string :

Data Source=(localdb)\MSSQLLocalDB;AttachDbFileName=C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\database.mdf;User ID=admin;Password=test;

I'm using :

  • Visual Studio 2019.
  • SQL Server 2019.

Update:

The answer suggested not working for me and I got this error :

Error on Connection settings System.Data.SqlClient.SqlException (0x80131904): An attempt to attach an auto-named database for file C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

The database is already attached :

enter image description here

sql-server
localdb
sqlexception
asked on Stack Overflow Jan 27, 2021 by csharp_devloper31 • edited Jan 27, 2021 by csharp_devloper31

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0