Solved

Unable to connect to SQL Server database.

Posted on 2011-09-16
8
277 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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.

739 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