-1

I am trying to make a registration page, that stores Username, password,and email, but When ever i try to Connect database using this string,

 SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RConnectionString"].ConnectionString);
 conn.Open();

Following Error appears:

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: 26 - Error Locating Server/Instance Specified)

I searched everywhere, but it didn't helped me..

Aristos
  • 66,005
  • 16
  • 114
  • 150
  • 1
    Welcome to Stack Overflow, please take the [Tour](http://stackoverflow.com/tour). Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – DavidPostill Aug 16 '14 at 19:05

1 Answers1

0

The issue starts from web.config and the connection string that is located at RConnectionString according to the code line you give.

Locate this string and fix it to been able to connect to your database.

And some examples here: Setting up connection string in ASP.NET to SQL SERVER

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150