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?



  • Options
    edited February 2013
    Connections in LINQPad are independent of queries - one connection is valid for any number of queries in any number of locations. Therefore, the path cannot be relative to a .LINQ file.

    If the .MDF file resides in or under the MyDocuments folder, however, LINQPad will encode the path relative to MyDocuments.
  • Options
    Thanks, I understand this and sorry to bother you again.

    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).


    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?

Sign In or Register to comment.