473,395 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Connection String question - accessing one string throughout solut

I was wondering if it was possible to store a connection string only once in
a single config file, and let it be accessible to every project in the
solution (web included). This way if the connection string needs to be
altered, it only needs to be changed in one place without having to worry
about consistency issues. Thanks for any help.
Apr 26 '06 #1
2 1305
If all the applications are on one computer, you could use machine.config.
If not, then you would have a mess of dependency issues, the server that the
file is stored on, would always have to be up and accessible and then it
wouldn't be an app/web config file. Rather, it would be a simple text file
with the connection string stored in it.

Additionally, environmental settings shouldn't be simply changed without a
process for testing the affect. That is why when the config files are
changes (winform and webform) the assembly spawns a new instance of itself
and orphans existing instances.

Certainly you can achieve as you ask, I only caution the feasibility.

Create a text file or xml file. Place it on a common store, have the
applications parse the file to get the connection string.

"gary g." <gary g.@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...
I was wondering if it was possible to store a connection string only once
in
a single config file, and let it be accessible to every project in the
solution (web included). This way if the connection string needs to be
altered, it only needs to be changed in one place without having to worry
about consistency issues. Thanks for any help.

Apr 26 '06 #2
Thanks for the reply. Just a little more background info on how my solution
is set up... The entire solution consists of many different projects, each
with their own separate .dll's and assembly info. Considering this, would it
still be possible to do as you suggested?
"AMDRIT" wrote:
If all the applications are on one computer, you could use machine.config.
If not, then you would have a mess of dependency issues, the server that the
file is stored on, would always have to be up and accessible and then it
wouldn't be an app/web config file. Rather, it would be a simple text file
with the connection string stored in it.

Additionally, environmental settings shouldn't be simply changed without a
process for testing the affect. That is why when the config files are
changes (winform and webform) the assembly spawns a new instance of itself
and orphans existing instances.

Certainly you can achieve as you ask, I only caution the feasibility.

Create a text file or xml file. Place it on a common store, have the
applications parse the file to get the connection string.

Apr 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Agoston Bejo | last post by:
Hi! Why doesn't the following code work? Sub Session_OnEnd Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionString = Application("Connection_String") Conn.Open ...
6
by: Andy Wawa | last post by:
Hi, on a simple HTML (not an ASP!)-Site I try to connect to a sql server (MS): <html> <title>Test</title> <head> <script language="javascript"> <!-- Function showForm(){
4
by: Mahesh D. Rane | last post by:
Hi, I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the...
6
by: Nifty | last post by:
After creating a routine to select from past ADODB connection strings, I found that it takes 60 seconds to timeout! I found the Microsoft article below ...
4
by: Eifel-benz | last post by:
How to get connection to a MS Access database? How to read from a MS Access database? How to close the connection to a MS Access database?
4
by: Mark | last post by:
OK. Here we go. I have an ASP.NET application that does many hits to a SQL Server DB on a separate server. When I first created this application (2 years ago) and was very new to ASP/ASP.NET, to...
2
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info...
10
by: Carlos | last post by:
Hi all, I am currently working on a project that needs to maintain the connection to the DB throughout the pages that the user navigates. I have already validated my DB connection and some...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.