Solved

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

Posted on 2008-06-25
6
2,160 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
[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
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

726 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