Reputation: 317
I am trying to run an application that has been downloaded from GitHub. The creator of the project provided usernames and passwords to log in for the application. Whenever I try to log in, I get an error that says:
"System.Data.SqlClient.SqlException: 'Cannot open database "Library" requested by the login. The login failed. Login failed for user 'DESKTOP-CBKOJI6\user'."
I tried doing the following but I still keep getting the same error
<connectionStrings>
name="DbConnection"
connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Library;Integrated Security=TrueConnect; Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" />
</connectionStrings>
This is the database that is in the App.config
The error I get is in this line of code:
con.Open();
EDIT 1:
Link for the project >> https://github.com/RuXeR97/Library
Upvotes: 1
Views: 194
Reputation: 97
Data Source=(localdb)\MSSQLLocalDB;
According to this line of code, you are trying to log into a local database which is supposed to be created by yourself locally. If the Github author already created a database on server and provided you with credentials, then all you have to do is to update this localDB server by the server name he provided in Github page.
Upvotes: 1
Reputation: 6417
You have to actually create the database first... You can't log into it if it doesn't exist.
Did the download come with a database project (you can publish that through visual studio), or .sql files (you can run them in SQL Server Management Studio) to create the database first.
Maybe link to the github project so we can take a look?
Upvotes: 1