I have written a C# program in Visual Studio 2010. I use database for my program by add service-based Database in VS2010. I make setup by add setup item for program. In my computer the program installed successfully and run very good. but in another machine after installing program when I want to work with database of program, 1 exception happened:”the program can’t find sql…..” and some errors like this.
Connection string is: (in single line)
"Data Source =.\\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\\database.mdf;
Integrated Security=True;
User Instance=True"
Also I included database.mdf file into setup files, but this problem has not been sloven.
what’s my connection string must be? Is this exception for that string?
The data source
\SQLEXPRESSshows me that you’re using a SQL Server Express Edition installed to your machine. When you distribute the program along with the database file, the SQL Server Express Edition must be installed on the target machine. Try using an embedded database like SQLlite if this is not desired, otherwise include SQL Server Express Edition within your installer.