0
votes

When I publish windows forms application it runs just fine on the machine I have developed it on.. but when I put it on another laptop it doesn't work. Double clicking on .exe files gives no error and nothing happens I have a local db in my application. connection string is "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True

publish setting are like this

enter image description here enter image description here

1
Look in event viewer on the machine it doesn't work on. That will show you why it's failing but at a guess it's to do with the local database not existing on the other machine. It doesn't matter if localdb exists on the other machine you still have to have an instance of your Database1 database. - Handbag Crab
I did a try catch and yes application is crashing because of database error. it says the server was not found or not accessible - Akash Gajbhiye
That's because Database1 is local only to you. Either you need a full SQL Server instance on a proper server that can be accessed by anyone or you need to install Database1 on the target machine before you run the application. - Handbag Crab
I installed sqlloacaldb and it work fine now. thanks :D - Akash Gajbhiye

1 Answers

0
votes

downloaded and ssqllocalDB from here installed it manually and application works fine now.