views:

55

answers:

4

It installed automatically with Visual Studio 2010 Ultimate. I didn't create any users for the server or ANYTHING.

I'm using:

string connectionString = @"Server=.\SQLEXPRESS;Database=SportsStore;Trusted_Connection=yes;";

I get error that authentication failed. So the server is being found, but my credentials are wrong. What would the default login and password be?

Edit: Still not working! :(

Here's my connection string:

string connectionString = @"Server=.\SQLEXPRESS;Database=SportsStore;Integrated Security=SSPI;";

And the error message:

Cannot open database "SportsStore" requested by the login. The login failed. Login failed for user 'ToshibaLaptop\Sergio'.

+1  A: 

If you are using SQL Server authentication you could try the username sa and blank password but I am not sure whether this is by default. Integrated Windows authentication should work, so you should be able to connect with your Windows account:

string conn = "Data Source=.\SQLExpress;Initial Catalog=mydb;Integrated Security=SSPI;";
Darin Dimitrov
Still getting the error. Can you please see my edit?
Sergio Tapia
+1  A: 

You probably should not connect using Sql Server Authentication.

Log in as an Administrator on the box, connect using Integrated Windows Authentication, and you should be a system admin.

Dave Markle
How can I say that in my connection string? Please see edit.
Sergio Tapia
@Sergio Tapia: use the `Integrated Security` flag. See Darin Dimitrov's answer.
BoltClock
Is there someway to get a connection string from a Linq-to-sql file? If I use that it justworks, but doing manually nothing works.
Sergio Tapia
Linq to SQL should put the connection string in your app.config or web.config. Copy it from there.
Dave Markle
A: 

In SQL 2008 if you use the defaults there won't be a SQL Server user only Windows Authentication will be enabled - and it will only work for the user that installed the application would have access via their Active Directory authentication.

u07ch
+1  A: 

The error message indicates that SQL Server can't open the database. I think you're successfully authenticating, but having a problem connecting to the database. Is the database available?

You can do a test by changing the database to master in your connection string. If that succeeds, then you're problem is related to the database. I understand that you may get other errors, but the test is to confirm that you can login to SQL Server.

bobs