This is my connection string on my Visual Studio, my database file name is IOOP_Database
Data Source=IDEA-PC\SQLEXPRESS;Initial Catalog=IOOP_Database;Integrated Security=True
The problem is when I run this system on another laptop, there will be a error because of the connection string. Is there any way I can state my connection string as Date Source=IOOP_Database.mdf? I've also moved my mdf file to my Visual Studio project's debug folder, so the project file and the sql database file are actually together.
You can use AttachDbFilename property in connction strings. It has some limitations and has been advised to use that only in development environment not production.
Also you might find these helpful:
similar question on stackoverflow
usage example