Solved

Cannot open database "Northwind" requested by the login. The login failed.

Posted on 2008-06-25
6
2,117 Views
Last Modified: 2013-11-06
Hello,

I know my question has always been asked here but I haven't found the solution.
I use vista (but same problem with XP), sql Server 2005 express and vs 2005 in cx#

This is my code :
string connectionString =
              @"Data Source=.\SQLExpress;Initial Catalog=Northwind;Integrated Security=True";

          try {
            using(SqlConnection connection= new SqlConnection(connectionString)){
                connection.Open();

                System.IO.StringWriter sw= new System.IO.StringWriter();
                sw.WriteLine("Connection Time Out : " + connection.ConnectionTimeout);
                sw.WriteLine("State : " + connection.State);
                sw.WriteLine("Connection String : " + connection.ConnectionString);

                DisplayText.Text = sw.ToString();
            }


My horror message :
Cannot open database "Northwind" requested by the login. The login failed.
Login failed for user 'PC-Medion\Pascale'.

I have no idea to make it works.


THanks
0
Comment
Question by:myebay
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:sbagireddi
ID: 21869530
Are you able to login using those credentials via Management Studio?
0
 

Author Comment

by:myebay
ID: 21869719
I've just installed Management studio express. What is credential  (I 've seen where is it)? WHat should I do with that?
0
 
LVL 8

Accepted Solution

by:
Chumad earned 500 total points
ID: 21869720
Some of these may be obvious:

1) Has SQL server actually been setup on your system? Are you sure you have an instance of it called .\SQLExpress?
2) Is there really a database called NorthWind? I know it's a default, but did you tell it to install?
3) Can you setup a username/pwd inside Sql Server (Using Management Studio), then NOT use Integrated Security and instead pass your username/pwd like this as the connection string: "data source=.\SQLExpress;database=Northwind;uid=someUser;pwd=somePassword" (be sure to insert your username/pwd into the string as indicated).
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.

 
LVL 8

Expert Comment

by:Chumad
ID: 21869728
For the Management Studio, if you don't know the username/pwd, then try to use Windows Authentication and see if you can get in.  
0
 

Author Comment

by:myebay
ID: 21869969
Now it works !!!

In fact, it's stupid... no Northwind installed in Sqlexpress 2005. I was sure I had it.

I had another problem that I've solved. I could do anything in the database, I had always Permission Denied.

I've found the solution here :

http://blog.techdreams.org/2007/11/create-database-permission-denied-sql.html

And now everything works fine :)

Thank chumad
0
 

Author Closing Comment

by:myebay
ID: 31470743
THank for your lights :)
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

912 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

20 Experts available now in Live!

Get 1:1 Help Now