I have written a desktop application (Windows Forms) in .NET Framework 4.0 using Visual Studio 2010 and SQL Server 2008.
In the /bin
folder, it creates an .exe
file which works fine on my computer and other computers if they have Visual Studio and SQL Server installed. If they do not have these installed, then it gives report error and the .exe
file does not run.
On another PC, I have tested it both on Windows XP sp3, Windows 7 after installing .NET Framework 4.0, and also installed Windows Installer 4.5 for WinXP sp3, but no success.
What is the problem? Is there anything wrong with my connection string which is:
@“Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\db.mdf;Integrated Security=True;User Instance=True";
How can I make my .exe file run on other PCs?
Thank you, this helped a lot and now I understand the problem is only connection string but problem still not solved. Now I am using this connection string
Data Source=HOME-9BE0D501F6\SQLEXPRESS;AttachDbFilename=|DataDirectory|\shopdb.mdf;Integrated Security= True;User Instance=True
WA-PC was the name of my computer where I was working and it worked fine but when I copied the bin folder to my other pc with name HOME-9BE0D501F6 it still did not worked. I have changed the connection string in app.config file with this name but still got connection error. I have not installed SQL Server 2008 on this pc. Do I have to install it? What else I have to do?