Login Failed for User I have written code in Visual Studio.NET and used data from SQL Server 2008. After debugging, it says: 

Login failed for user 'sunny'. 


When I try to set the user as something else, it keeps on reporting that error. I start sql with windows authentication and the username there is: sunny-lptp\sunny.

I do not have any sql authentication user/pass on sqlserver express 2008.

I tried changing the authentication in server/security tab. I changed it to both windows and sql. but it didn't fix the error.

What should I do?

Here is the connection string in web.config:

&lt;configuration&gt; 
    &lt;appSettings&gt; 
        &lt;add 
            key="SchoolsDBConnectionString" 
            value="server=sunny-lptp\sqlexpress;database=SchoolsDB;"&gt;
        &lt;/add&gt; 
    &lt;/appSettings&gt;


And the code:

scn = new sqlConnection(
    ConfigurationManager.AppSettings["SchoolsDBConnectionString"].ToSt‌​ring());
Append on Trusted_Connection=True to the end of your connection string in your config file:

server=sunny-lptp\sqlexpress;database=SchoolsDB;Trusted_Connection=True


Great resource for connection strings