I have a Winforms application and I would like to save my database.mdf to %USERPROFILE% folder. Does anyone know what i need to write to the connection string for this to work? Simply using %USERPROFILE% does not work.
You can refer to this
String query = "%USERPROFILE%";
String pathOfUserProfile = Environment.ExpandEnvironmentVariables(query);
Console.WriteLine(pathofUserProfile);
You will get the path in string. Now simply create your connection string as usual