0

The word is, I would like to run my C# app on a computer with Windows XP and SQL Server 2008 R2 Express installed. Although I tried any possible connection strings, I could not run my App on that computer. Any help will be highly appreciated.

I tried these connections strings:

Data Source=(local); integrated security=SSPI; database=SepidarDatabase.mdf

server=.\SQLEXPRESS;integrated security=SSPI;database=SepidarDatabase.mdf

"Data Source=.\SQLEXPRESS;SepidarDatabase.mdf;Integrated Security=True"   
providerName="System.Data.SqlClient"

They all throw an exception error:

Invalid Value Key for "attachDbFileName"!

Niels Keurentjes
  • 41,402
  • 9
  • 98
  • 136
Shadan Golestan
  • 106
  • 1
  • 6

1 Answers1

0
<add name="LPSConnection" connectionString="Data Source=Your-Data-Source;Initial Catalog=Database-Name;Uid=Your-User-Id;pwd=Your-Password;MultipleActiveResultSets=true;Connect TimeOut=600;" providerName="MySql.Data.MySqlClient"/>

Add this into your app.config file.it is working for me perfectly.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
yash
  • 812
  • 3
  • 12
  • 37
  • Thanks for your reply. I just added the following connection string according to your reply but it didn't work. Note that since I use windows authentication, I replaced "integrated security=SSPI" instead of Uid and pwd. '' – Shadan Golestan Aug 06 '14 at 08:14
  • Try setting Integrated Security=true, sometimes this also works@user3913217 – yash Aug 06 '14 at 08:17
  • Sorry... I am new to StachOverFlow; So I'm not so familiar how to format my comments just like yours. – Shadan Golestan Aug 06 '14 at 08:19
  • that's not the problem @user3913217 – yash Aug 06 '14 at 08:20
  • 1
    Oh, i think you should use AttachDbFilename instead of Initial Catalog. and have to give physical path instead of file name @user3913217 – yash Aug 06 '14 at 08:24
  • Dear @yash, I have already attached my DB by using SQL management studio, so I don't think I need to attach it again. – Shadan Golestan Aug 06 '14 at 10:59