Solved

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

Posted on 2008-06-25
6
2,133 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
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.

 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

809 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