473,395 Members | 1,694 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.

Move connection string from actual page to web.config.

How do I move my connction string from each page and instead refer to it
from the web.config file?
In Web.Config I have

<appSettings>

<add key="ConnectionString"
value="server=Server;database=DB;uid=name;pwd=p"/>

</appSettings>

Inmy webform I have

private void InitializeComponent()

{

this.connection.ConnectionString = "workstation id=PC...

regards

Reihaa
Nov 16 '05 #1
1 2747
Hi,

Use
System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];
to get the key ConnectionString.

--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"rehiaa" <th******@online.no> je napisal v sporočilo
news:uB**************@TK2MSFTNGP09.phx.gbl ...
How do I move my connction string from each page and instead refer to it
from the web.config file?
In Web.Config I have

<appSettings>

<add key="ConnectionString"
value="server=Server;database=DB;uid=name;pwd=p"/>

</appSettings>

Inmy webform I have

private void InitializeComponent()

{

this.connection.ConnectionString = "workstation id=PC...

regards

Reihaa

Nov 16 '05 #2

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

Similar topics

2
by: Steve | last post by:
I am trying to move my connection settings out to a config file, rather than having them hardcoded in my app. What is the best way of doing this? I created a simple xml doc that looked something...
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...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
6
by: Mike L. | last post by:
Hi, Pls, beware that I'm new to this :) I've developed several web appl, either with ASP or ASP.NET. All using SQL server as the back end. In my development environment, I have a single...
2
by: Shapper | last post by:
Hello, I have a dataset in an ASP.NET/VB web page: Function dsNews() As System.Data.DataSet Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data...
19
by: Jaime Stuardo | last post by:
Hi all.. I have created a business logic component that is used from my ASP.NET webform. It works, but connection string to the database is hard coded, as in this method : public DataSet...
0
by: Orbit | last post by:
Hi, I hope someone could help me. I have a simple web service that I developed on my laptop that resides within a large web application. It queries Northwind & presents the data in a grid in the...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a question about storing the connection strings to the database in a config file or database. My manager wants me to store all the connection strings in a database, but I...
10
by: jimjim | last post by:
HI, We have shifted our database from sqlserver2003 to sqlserver2005. 1. connection strings stored in web.config <!-- Machine name to connection string keys --> <add key="*777*"...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.