views:

230

answers:

3

I have SQL Server 2005 installed and VS 2008 on Windows XP Pro SP2.

I am building a VB.Net windows application and trying to add a .mdf database to it as a local db inside the project.

But i always receive this message:

"Local database file

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.

OK "

i searched on google for this error, and tried the first 3 links which are mainly talking about this solution:

"delete the C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory.

Then restart ur machine."

But i don't have this directory

Here are some screen shots from my machine:

Image1

Image2

Image3

Image4

Does anyone faced this problem before and how to solve it?

A: 

If you have SQL Server 2005 rather than SQL EXPRESS, User instances are not supported

Roger Willcocks
means i can't use sql express while i have sql server 2005?
Amr ElGarhy
Correct. User instances are only supported in SQL Express, and you cannot install SQL Express 2005 and SQL Server 2005 on the same machine.
Roger Willcocks
+1  A: 

Is there a logfile in the C:\Documents and Settings\\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory or does it not exist at all?

I'd say it's most likely a permissions issue have you checked that the user the SQL server is running as has access to the folder above or its parent folders or the data folder which would be under c:\program files\Microsoft SQL server or similar

Steve Temple
I think its a permission issue also, should i just add sql server user access to this folder? or also reinstall sqlexpress after that? and which user should i give access?
Amr ElGarhy
I would try giving the sql user access to that folder, if that doesn't work reinstall sql express, although a little more time consuming it usually fixes the problem.Take a look in services and see what user SQLEXPRESS is running as, and give that user permission
Steve Temple
+1  A: 

Exactly Solved my problem:

http://jeremywadsworth.com/Default.aspx?blogentryid=64

"Milan said...

just want to comment on: The solution to ur problem goes lik this.

  1. Open SQL Server Configuration Manager. Navigation to Start > Microsoft SQL Server 2005 > Configuration Tools > SQL Server Configuration Manager
  2. Double-click SQL Server (SQLEXPRESS) and change it to use LocalSystem
  3. Delete the folder
    • Windows Vista: C:\Users[user]\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
    • Windows XP: c:\Documents and Settings[user]\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

more info at: http://forums.microsoft.com/msdn/showpost.aspx?postid=98346&siteid=1.

That’s it. Does that fix your problem? it should fix ur problem ... FANTASTIC! Thanks very much, I've spent 4 days trying to solve this, this is the first site where I've found a solution to this problem. Thanks again!"

Amr ElGarhy