How to write the connection string to local SQL Server database using web.config?
Here is my connection string in web.config. But when I open local/demo, it said:
login failed for user ''.
Actually I'm using Windows authentication, so I thought it doesn't need user and password.
<connectionStrings>
<add name="HRISContext"
connectionString="data source=.;initial catalog=BPSDEMO;Pooling=false;persist security info=True;user id=;password=;MultipleActiveResultSets=True;App=EntityFramework"
providerName="System.Data.SqlClient" />
</connectionStrings>
<add name="HRISContext" connectionString="data source=.;initial catalog=BPSDEMO;Pooling=false;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />For more information check connectionstrings.com/sqlconnection<add name="HRISContext" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\BPSDEMO.mdf;Initial Catalog=BPSDEMO;Integrated Security=True;MultipleActiveResultSets=True" />The error message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - @MohsinMehmoodApp_Datafolder. Basically, this option allows you to deploy your database file along your project.