1

Everyone I have created a .exe file with localdb and that db file pos.mdf is include in winforms application and I use local db connection string like(connectionString="Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFileName=|DataDirectory|\Data\POS.mdf; Initial Catalog=POS;Integrated Security=True") and I use linq in my app and I created .exe of my app successfully through Visual Studio Installer, but the problem is after successfully installation my pos app can't be run/open I don't know why and what's the problem with my app. Visual Studio 2017. Sql Server 2014. please help me to correct it. Thanks in advance

Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171
Jagdish Kumar
  • 225
  • 1
  • 4
  • 14
  • Did you check any logs in eventvwr.msc? – Maarten Apr 07 '19 at 09:40
  • 1
    [SQL Server 2016 Express LocalDB](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-2016-express-localdb?view=sql-server-2017). Just in case, take a look at the last paragraph first (Permissions). This decription may also help: [local database not updating when using |DataDirectory|](https://stackoverflow.com/a/53643907/7444103). – Jimi Apr 07 '19 at 09:57

1 Answers1

0

connectionString="Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFileName=|DataDirectory|\Data\POS.mdf; Initial Catalog=POS;Integrated Security=True"

change to

connectionString="Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFileName=|DataDirectory| Data\POS.mdf; Initial Catalog=POS;Integrated Security=True"

Jagdish Kumar
  • 225
  • 1
  • 4
  • 14