Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’
If this error occurs when connecting a custom web part to the Sql database it usually means that the Anonymous Logon identity doesn’t have permissions to the specified database. To resolve this we can either change the identity to one that does, or give these account permissions; Or, use SQL Server authentication.
If Windows Authentication mode is selected during installation, the sa login is disabled. If you later change authentication mode to SQL Server and Windows Authentication mode, the sa login remains disabled. To enable the sa login, use the ALTER LOGIN statement.
ALTER LOGIN sa ENABLE ;
ALTER LOGIN sa WITH PASSWORD = ‘<enterStrongPasswordHere>’ ;
Now, the sa account can log in and access the databases in the custom web part.