Multiple Connection Strings for Multiple Dlls

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

Hi!

I am facing a small problem.
Actually i have a solution having around 5 Dll Projects. Each dll project is
named as Project1.DAO, Project2.DAO ......

Now i have a connectionstring each of the project which is named as :-
Project1.DAO.ConnectionString
Project2.DAO.ConnectionString

which are accessing the same database.

The Problem i am facing is.. when i reference these dll's from a exe project
i have to add all the COnnection string into the exeprojects app.config.
whihc is a lot of redundant info as all the connection string values are
same.

Please suggest a solution
 
P

Paul O'Flaherty

Hi

Have you thought about using an xml file to hold the connection string. If
the xml file is installed in the same path as the dll's you can access this
xml using:

StrAssemblyLocation = Me.GetType().Assembly.Location
StrPathToSettingsFile = Left(StrAssemblyLocation,
InStrRev(StrAssemblyLocation, "\"))

You could then read this file to get the connection string.

Have a look at this article about using serialization to do this exact thing
http://www.codeproject.com/KB/cs/ReadWriteConfig.aspx?df=100&forumid=308512&exp=0&select=1511421
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top