Link to home
Start Free TrialLog in
Avatar of WhyDidntItWork
WhyDidntItWork

asked on

Unable to connect to SQL Server database.

I'm new to VWD 2010 and SQL Server 2008 R2. I've had to reinstall SSMS. I renamed the server "SQLEXPRESS2008R2". I also used mixed authentication.

However, now, when I go to configure a website project, I get the message "Unable to connect to SQL Server database" from VWD. I've already went into the Options menu and changed the named instance of the server to "SQLEXPRESS2008R2". I think that was part of the problem.

I've tested SSMS and it seems to be working fine so I think it's just a connection issue between VWD and SQL Server 2008 R2.

However, I didn't see anyplace in the options menu to store my SQL Server username and password. I think that's what is tripping me up. Do I put the user name and password into my web.config file each time I want to configure a website project? Can someone provide the syntax for the web.config file to pass the parameters?
Avatar of jagssidurala
jagssidurala
Flag of India image

Avatar of WhyDidntItWork
WhyDidntItWork

ASKER

I tried this in the web.config file:
<connectionString>
        <clear />

        <add name="connectionString" connectionString ="Data Source=DADDY-PC\SQLSERVER2008R2;Database=ASPNETDB;Uid=sa;Password=xxxxx;" />
       
</connectionString>

ASP.Net didn't like it:
The following message may help in diagnosing the problem: Unrecognized configuration section connectionString. (C:\...website\web.config line 11)

Can someone help me with the syntax or point out what I'm doing wrong?
Connection strings should be the first tag in web.config after wards appsettings.........etc
Hi.

Thanks for the suggestions jaqssidurala.

I've amended the web.config file in the root directory as follows:

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<!-- Does not include email configurations which is included in the live web.config file uploaded to the website. -->

<configuration>
    <connectionString>
        <clear />

        <add name="connectionString" connectionString ="DADDY-PC\SQLEXPRESS2008R2;database=ASPNETDB;uid=sa;password=xxxxx;providerName=System.Data.SqlClient" />

    </connectionString>

</configuration>

I've tried multiple combinations on the host and still get the same error. As per above, the connection string is the only element inside the configuration element.
Check following suggestions

1)The accces should be there between web server and DB server

2) Try by removing clear tag in web.config

3) verify DB uid and password

Hi.
1) Not sure what you mean by "access".

2) Clear tag was removed. No difference in result.

3) DB uid and password works in SSMS.

ASP.Net didn't like it:
The following message may help in diagnosing the problem: Unrecognized configuration section connectionString. (C:\...website\web.config line 11)

The web.config file reads as follows:
<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<!-- Does not include email configurations which is included in the live web.config file uploaded to the website. -->

<configuration>
    <connectionString>
       
        <add name="connectionString" connectionString ="DADDY-PC\SQLEXPRESS2008R2;database=ASPNETDB;uid=sa;password=xxxxx;providerName=System.Data.SqlClient" />

    </connectionString>

</configuration>
ASKER CERTIFIED SOLUTION
Avatar of jagssidurala
jagssidurala
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not really helpful when ppl just send you links to a problem.