try this
AppDomain.CurrentDomain.SetData("DataDirectory", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
<connectionstrings>
<add name="DATABASENAME">
connectionString="Data source=DataDirectory|DATABASEFILENAME;"
providerName="YOURPROVIDERNAME"/>
</add></connectionstrings>
Hope this will help you