• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

sql connection with VS2008

Hi

I use VS 2008 and SQL express 2005

When I connect to database through Sql server managment studio express then when I want to connect to the same database with VS 2008 or program that I created i get error

Cannot open user default database. Login failed. Login failed for user 'domain\user'.

After reboot pc and first connect with program or VS then I can connect to database but then I can't connect with sql server menagment

I get the same error

everything I do localy I just start to learn sql and VB. Looks like I can't connect more then once with the same user. Even if i shut down booth aplication  I can't connect to database after. I need reboot pc to connect to.
0
gowerman
Asked:
gowerman
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Cannot open user default database.

that means that the login 'domain\user' has a default database specified which does not exist, or to which that login has no permissions to.
double check the logins setting (ie reset the default database to "master")...
0
 
gowermanAuthor Commented:
but I can connect to database with this login  after reboot pc
0
 
mhjassocCommented:
I have the same issue; however, I am using VS C# express 2008 with the SQL express 2008. My original database was backed up on another system and then restored that backup into SQL express 2008. The issue is it makes development with a database a bit difficult b/c I have to reboot each time I need to work with the database between C# and SQL.
0
 
mhjassocCommented:
Forgot to add my original database came from sql express 2005.
0
 
gowermanAuthor Commented:
The problem was that i connect to a file. Now Im using

 Dim sqlconnection1 As New SqlConnection("Data Source=.\SQLEXPRESS;Database=xxxxx;Trusted_Connection=True")

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now