0

I have multiple display programmed using C# connecting to a SQL database. I am trying to move the database from a computer on our network to the IT department SQL server for backup and stability reasons (the current computer I have been using is in our factory and used for running the display of one of our machines and has been shut off, had hard drive failures, etc). I get the following error when I run.

The program works when I set Integrated Security = True and add the windows logins as administrators into SQL server for the specific database, but the IT department does not want to have 20 or so username/ passwords in the SQL server for all the computers that are using the program so they created a user for the SQL server that will encompass all the users.

string SQL_Connection = @"Data Source = ComputerName; Initial Catalog = DatabaseName; Integrated Security = False; User ID = Username.sql; Password = Password ; Connect Timeout = 15;";

$exception {"Login failed for user 'Username.sql'."} System.Data.SqlClient.SqlException

The error log shows:

Login failed for user 'Username.sql' Reason: Could not find a login matching the name provided. Error: 18456, Severity: 14, State: 5.

Sean
  • 17
  • 4
  • 1
    The error seems clear, no? That user doesn't exist on that SQL Server instance. –  Jul 19 '19 at 18:02
  • This doesn't sound right. Perhaps they created a group with the proper permissions and you just need a SQL account that is a member to that group. – UnhandledExcepSean Jul 19 '19 at 18:07
  • You could always start reading the [documentation](https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-18456-database-engine-error?view=sql-server-2017) – Jeroen Heier Jul 19 '19 at 18:22
  • 1
    This might be a duplicate of another question asked at Stackoverflow. please check this SO link for your answer. https://stackoverflow.com/questions/17372606/sqlserver-login-failed-for-user – VAT Jul 19 '19 at 18:23

1 Answers1

-1

I was able to fix the issue. The users were created as windows authentication instead of sql authentication. When I had the users switched to sql authentication, the problem went away.

Sean
  • 17
  • 4