Solved

Unable to connect to SQL Server database.

Posted on 2011-09-16
8
234 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:WhyDidntItWork
  • 4
  • 4
8 Comments
 
LVL 12

Expert Comment

by:jagssidurala
Comment Utility
0
 

Author Comment

by:WhyDidntItWork
Comment Utility
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?
0
 
LVL 12

Expert Comment

by:jagssidurala
Comment Utility
Connection strings should be the first tag in web.config after wards appsettings.........etc
0
 

Author Comment

by:WhyDidntItWork
Comment Utility
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.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 12

Expert Comment

by:jagssidurala
Comment Utility
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

0
 

Author Comment

by:WhyDidntItWork
Comment Utility
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>
0
 
LVL 12

Accepted Solution

by:
jagssidurala earned 500 total points
Comment Utility
0
 

Author Closing Comment

by:WhyDidntItWork
Comment Utility
Not really helpful when ppl just send you links to a problem.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now