I am attempting to connect to a local SQL Server database in C#.
I am currently using the following connection string:
connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\User\source\repos\majorWork\majorWork\gameStats.mdf;Integrated Security=True";
However, I do not want to use a hardcoded file path, as I wish to be able to use the application across multiple computers, where the file path will be different. How should I go about doing this?
Databasewhere the application is running. Then you can use relative path asAttachedDbFileName = .\Database\gameStats.mdf