Database connection

Can't connect to a database

Page 1 of 1

2 Replies - 1946 Views - Last Post: 01 October 2008 - 02:37 PM Rate Topic: -----

#1 WayneSpangler  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 106
  • Joined: 22-March 08

Database connection

Posted 01 October 2008 - 01:57 PM

Hi guys,
I am trying to learn database programing. It doesn't seem hard to create a database. However, it seems impossible to connect to it. In Vb Express 2008 I clicked on then Add Data Source. I chose the database and selected New Connection. I selected Microsoft SQL Server Database File and then clicked OK. In the Database file name I browsed to it and selected it and then pressed OK.
I then get then error message:

Quote

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

I have tried everything I can find on the internet but cannot get the data source.
Why has Microsoft tried so hard to keep you away from something you created. It doesn't make sense.
Any help would be appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Database connection

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Database connection

Posted 01 October 2008 - 02:01 PM

This error is often caused because the parent instance (for whatever reason) can't copy the system databases to the users local isolated storage folders. Sometimes it is because of a previous install of SQL Express has left files in that directory which is why Reen's suggestion sometimes works

Delete C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS.

the only trick is knowing the USERNAME, if your writing a web app, the user is usually ASPNET which is usually found in

C:\Documents and Settings\COMPUTERNAME\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

Other times it is a permissions issue which can be solved by giving the SQL service account the necessary permissions.

One thing to remember is that although user instances is the default when working with Visual Studio, it is not mandatory to use them, it is quite possible to attach to databases in the traditional way from SQL Express, to do this you just need to edit the connection string and delete the "user Instance=true". User Instances just make it easier (when it does work) to work with databases as though they were files.
Was This Post Helpful? 0
  • +
  • -

#3 WayneSpangler  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 106
  • Joined: 22-March 08

Re: Database connection

Posted 01 October 2008 - 02:37 PM

Thanks that did it. Now I know where to get good info about databases. I hope you don't mind.
:^: :^: :^: :^: :^:
I am using vista and had to find a different path. It is:
C:\Users\Wayne\AppData\Local\Microsoft\Microsoft SQL Server Data

This post has been edited by WayneSpangler: 01 October 2008 - 02:40 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1