Solved

Unable to connect to SQL Server database.

Posted on 2011-09-16
8
280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

691 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