Solved

Unable to connect to SQL Server database.

Posted on 2011-09-16
8
256 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
ID: 36551104
0
 

Author Comment

by:WhyDidntItWork
ID: 36551114
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
ID: 36551131
Connection strings should be the first tag in web.config after wards appsettings.........etc
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:WhyDidntItWork
ID: 36551227
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
 
LVL 12

Expert Comment

by:jagssidurala
ID: 36551285
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
ID: 36551430
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
ID: 36551462
0
 

Author Closing Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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 combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

776 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