I am trying to make some simple libraries that require database access. What I don’t get is how to pass the connection string to the library… Right now I have a db.config in my dll, but I’m not sure how to reference it from within the dll etc…
This is how I have setup the libraries
[Solution File]
- Library1
- db.config
- Library2
- linked db.config
<configuration>
<!-- Connection string -->
</configuration>
- How do I reference the db.config from within dll?
- How do I reference the db.config from a web applications web.config?
Real simple:
1) If this happens to be a .Net .dll, you can store it in “app.config” or “web.config”:
Example:
2) You can also store the connection string anywhere that the .dll can read it. For example, you can use an .ini file or the registry.
3) You can implement a
getConnectionString()method in your .dll.4) Etc. etc. etc.