Solved

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

Posted on 2008-06-25
6
2,109 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
Comment Utility
Are you able to login using those credentials via Management Studio?
0
 

Author Comment

by:myebay
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 8

Expert Comment

by:Chumad
Comment Utility
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
Comment Utility
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
Comment Utility
THank for your lights :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
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 use and create keystrokes in Netbeans IDE 8.0 for Windows.

772 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

16 Experts available now in Live!

Get 1:1 Help Now