I have created basic login module in ASP.net using C#. I am using C# web application for this purpose.
Earlier I used SQL Server 2008 Express as a database. At that time application was running fine.
But then I uninstalled that database and installed SQL Server 2008 R2.
From that point onwards I am getting error:
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: 25 – Connection string is not valid)
I found in config.xml I have code as:
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS ;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
where my SQL Server is called MSSQLSERVER.
This connection string must be the issue. But I am not able to resolve this issue.
Is my conclusion correct and can I get some help?
PS: my SQL Server 2008 R2 is installed correctly.
But whenever I try to connect with SQL Server 2008 R2 its connecting to 2008, which is uninstalled but have same name. (both earlier and this server have same name i.e. my computer name.)
I have used following connection String:
And it worked!!!
But just one concern, is this connection will be safe for Login database?
Got the connection string help from Connection String and thanks to Marc_s