Maybe a little late, but I came across this issue that is struggling with the same problem. Folder Location |DataDirectory| can be found in AppDomain.CurrentDomain.GetData("DataDirectory") . Thus, your connection string can be translated as follows:
strConn .Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory").ToString())
source share