“Login failed for user” SQLConnection using C#

SQLConnection,“Login failed for user” SQLConnection using C# ,Server DB Connection,windows authentication,Asp.net
Share it:
“Login failed for user”  SQLConnection using C#

This is the Common Problem we are facing in Server DB Connection in Asp.net.If you are using windows authentication to connect to the Server DB, you need to set “Trusted_Connection=True;” if you're using SQL Server authentication, you would like to declare User “Id=myUsername; Password=myPassword;”




Code Snippet In Web.Config:

Windows authentication

<add name="windowsConnection" connectionString="Server=localhost; Database=databasename; Trusted_Connection=True;" />


SQL server authentication
<add name="Sqlserverconnection" connectionstring="server=localhost; Database=databasename;uid=db; password=123 "/> 

Do you know:-


If you like the tutorial, then please share this tutorial with your friends on social media.
Share it:

aspnet

C#

sql

Windows Forms

Post A Comment:

0 comments: