Cannot open SQL Server Express table with StudioExpress & C#Express

I have a problem to open SQL Server 2005 Express table with both Studio Express and C# Express>Database Explorer at the same time.

I can open table with both tools indivisually. However, if I open table with Studio Express first, then try to open it with C# Express>Database Explorer, it comes out an error:
Cannot open user default database. Login failed.
Login failed user 'myComputerName\Administrator'

Then I exit Studio Express, open the table with C# Express>Database Explorer , it works.
Then I restart Studio Express, failed to open it with an error:
Failed to retrieve data for this request(Microsoft.sqlserver.Express.SmoEnum) Unable to open the physical file:''myPath\myDb.mdf'.

Does anyone can help Thanks!



Answer this question

Cannot open SQL Server Express table with StudioExpress & C#Express

  • brian185

    Thanks for reply, but I don't understand the normal db connection string you meant.

    However, I tried to change User instance = False in connecting string. Then it worked!
    The table can be opened in both Studio and C# Express IDE at the same time.

    I checked help for User instance, it is for non-administrator user when set to true. But I am administrator, maybe it is the reason I have to set to false.


  • jot

    Here is a good article on User Instances in SQL Server Express.

    SQL Server 2005 Express Edition User Instances
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnsse/html/sqlexpuserinst.asp



  • Chippe01

    Try closing the C# Express IDE, the open the db in the sqlexpress studio. With the express ide you are using a User Instance of the SQL Express Engine, and the IDE will have a exclusive connection to the files. If you want to have them both open at the same time you will need to attach the db file to the ./sqlexpress engine using the sql studio and then moderfy your connection string to connect using the normal db connection string.



  • Cannot open SQL Server Express table with StudioExpress & C#Express