Relative location for SQL connection?
With apologies if the answer is well known.
How can we set a new SQL connection to a relative location, possibly the folder containing the .LINQ file?
Something like the substitution string|DataDirectory| in Visual Studio?
Thanks
How can we set a new SQL connection to a relative location, possibly the folder containing the .LINQ file?
Something like the substitution string|DataDirectory| in Visual Studio?
Thanks
Comments
If the .MDF file resides in or under the MyDocuments folder, however, LINQPad will encode the path relative to MyDocuments.
However, there are scenarios when a relative address could be useful. For example, consider that I have a suite of .LINQ files all using the same .MDF and I need to distribute these to several colleagues, who are working on different machines, with different policies.
The simplest way seems to develop all files, .LINQ and .MDF together, in the same folder and then broadcast this folder as a unit (by XCOPY, Email, etc). Each recipient could store the received folder in her favourite location and immediately start working, provided that relative addresses are accepted.
This seems technically possible. Each .LINQ source file seems to contain, in its XML preamble, all details required to build the connection string. Currently, for an attached database file, the stored address is absolute. However, it could also be relative, thus each file could indicate its own relative database file (possibly in the same folder).
.\northwnd.mdf
Would this be possible? Or, is it an alternate way that enables such a simple "XCOPY" distribution, of .LINQ queries and their associated .MDF database files?