0

I have created a winforms application with Visual Studio 2010 and a setup project for it. My application works with SQL Server Express so I have added SQL Server 2008 Express to the list of prerequisites of the setup.

In addition I have used the following connection string to connect to my database :

Data Source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|MyDBName.mdf; Integrated security=True;

My application and its setup project build successfully but when I have installed and run it (even as administrator) I receive an error :

cannot open a user default database.login failed. login failed for this user.

What is my mistake??

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
M_Mogharrabi
  • 1,369
  • 5
  • 29
  • 57
  • 2
    try adding `;User Instance=True` in the connection string –  May 01 '12 at 05:21
  • I have tried it already but it did not work. – M_Mogharrabi May 01 '12 at 05:28
  • http://stackoverflow.com/questions/8528768/cannot-open-user-default-database-login-failed-after-installing-sql-server-m –  May 01 '12 at 05:32
  • http://social.msdn.microsoft.com/forums/en-US/sqlexpress/thread/24cbe0d8-c439-4cf3-9999-5dd8f02ed2c9/ –  May 01 '12 at 05:32
  • Hi HaLaBi,Thanks. your first suggestion work for me.I have used User Instance again and it was worked.I do not know why at the first time it did not work. – M_Mogharrabi May 05 '12 at 04:22

0 Answers0