Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-06-25
6
Medium Priority
?
2,207 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 2000 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

705 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