changing a connection string in a library class at run time vb.net
Posted on 2014-03-06
So I have a solution split into several projects. The main project being a windows forms project. The problem is that one of my class libraries contains a connection string that is pointing to a sqlite database in the application directory. Currently it is an absolute path but I would like to change it to based on what the current application directory is. I am able to construct the path using my.application.info.directorypath but setting the application.setting won't work from what I understand due to it being a Class Library. and no dll.config file. The actual connection string is used by multiple table adapters as defined in the .xsd files and the code visual studio has created for the basic functionality.
Hopefully there is a way around this. At the moment every change of install path requires updating the settings pre-build which won't work moving forward when we pull together an installer for this.
Thanks in advance!