Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2008

Tip: Looking for answers? Try searching our database.

Multiple Connection Strings for Multiple Dlls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
msnews.microsoft.com - 19 Mar 2008 08:22 GMT
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
Paul O'Flaherty - 19 Mar 2008 14:04 GMT
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


> Hi!
>
[quoted text clipped - 14 lines]
>
> Please suggest a solution

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.