473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Misunderstandin g ConnectionStrin gs?

I have a web project whose web.config has a ConnectionStrin g setup. I have
a second assembly with my Typed DataSets. The designer has created an App.config
file with a connection string in it for the designer to use. The web project
referecnes the data assembly with the TDS's in it. When I deploy this project,
my Typed DataSets are still using the data in the app.config, and not the
one in the web.config. Any idea on how to tell it to get the ConnectionStrin g
data from web.config and ignore the app.config?

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com
Jan 9 '06 #1
6 1412
As I undestand, your TDS's are in a dll project? Just a thought - you can try
to remove dllname.config file from the bin folder - I think then ASP.Net will
use web.config...

"Shawn Wildermuth" wrote:
I have a web project whose web.config has a ConnectionStrin g setup. I have
a second assembly with my Typed DataSets. The designer has created an App.config
file with a connection string in it for the designer to use. The web project
referecnes the data assembly with the TDS's in it. When I deploy this project,
my Typed DataSets are still using the data in the app.config, and not the
one in the web.config. Any idea on how to tell it to get the ConnectionStrin g
data from web.config and ignore the app.config?

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com

Jan 10 '06 #2
Thanks for Sergey's inputs.

Hi Shawn,

As Sergey has mentioned, when we create the TableAdapter(da taset) in a
class library project, the connection string setting is retrieved from the
Application Settings collection defined there. And actually the application
settings collection is persisted in app.config file... So when we use the
class library assembly in a end client application (winform or asp.net), we
can override those settings in teh application's config file (app.config or
web.config...). If we don't override, they use those default values defined
in class library...

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: Misunderstandin g ConnectionStrin gs?
| thread-index: AcYVe1HDeeq1cHE lRLq4Owmrb9gwfA ==
| X-WBNR-Posting-Host: 202.7.176.134
| From: "=?Utf-8?B?U2VyZ2V5IFB vYmVyZXpvdnNraX k=?="
<Se************ *****@discussio ns.microsoft.co m>
| References: <fc************ *************@m snews.microsoft .com>
| Subject: RE: Misunderstandin g ConnectionStrin gs?
| Date: Mon, 9 Jan 2006 16:18:02 -0800
| Lines: 20
| Message-ID: <29************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA01.phx.gbl!T K2MSFTNGXA03.ph x.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3696 53
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| As I undestand, your TDS's are in a dll project? Just a thought - you can
try
| to remove dllname.config file from the bin folder - I think then ASP.Net
will
| use web.config...
|
| "Shawn Wildermuth" wrote:
|
| > I have a web project whose web.config has a ConnectionStrin g setup. I
have
| > a second assembly with my Typed DataSets. The designer has created an
App.config
| > file with a connection string in it for the designer to use. The web
project
| > referecnes the data assembly with the TDS's in it. When I deploy this
project,
| > my Typed DataSets are still using the data in the app.config, and not
the
| > one in the web.config. Any idea on how to tell it to get the
ConnectionStrin g
| > data from web.config and ignore the app.config?
| >
| > Shawn Wildermuth
| > C# MVP, Author and Speaker
| > http://adoguy.com
| >
| >
| >
|

Jan 10 '06 #3
Hello Sergey,

No app.config in the bin folder...what it was is that they are pre-pending
the project name to the connection string, e.g. MyCOmpany.MyAss embly.Settings. SomeOtherStuff. ConnectionStrin gName.
NO way I can tell to have the dll not create all that namespace clutter
so I had to create a second conneciton string in my web.config:

<connectionStri ng name="myConnStr ing" ... />
<connectionStri ng name="MyCompany .MyAssembly.Set tings.SomeOther Stuff.myConnStr ing"
.... />

To make it work. I don't like this solution so if someone knows how to specify
a realisticly named Connection String in the Table Adapter, I'd appreciate
it.

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com
As I undestand, your TDS's are in a dll project? Just a thought - you
can try to remove dllname.config file from the bin folder - I think
then ASP.Net will use web.config...

"Shawn Wildermuth" wrote:
I have a web project whose web.config has a ConnectionStrin g setup.
I have a second assembly with my Typed DataSets. The designer has
created an App.config file with a connection string in it for the
designer to use. The web project referecnes the data assembly with
the TDS's in it. When I deploy this project, my Typed DataSets are
still using the data in the app.config, and not the one in the
web.config. Any idea on how to tell it to get the ConnectionStrin g
data from web.config and ignore the app.config?

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com


Jan 10 '06 #4
Hello Steven Cheng[MSFT],

Please see my reply to Sergey. Is there a way to tell the app to use a shorter
connection string name? We only have one so naming it with the entire setting
container is a waste of space and mindshare.

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com
Thanks for Sergey's inputs.

Hi Shawn,

As Sergey has mentioned, when we create the TableAdapter(da taset) in a
class library project, the connection string setting is retrieved from
the Application Settings collection defined there. And actually the
application settings collection is persisted in app.config file... So
when we use the class library assembly in a end client application
(winform or asp.net), we can override those settings in teh
application's config file (app.config or web.config...). If we don't
override, they use those default values defined in class library...

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Misunderstandin g ConnectionStrin gs?
| thread-index: AcYVe1HDeeq1cHE lRLq4Owmrb9gwfA ==
| X-WBNR-Posting-Host: 202.7.176.134
| From: "=?Utf-8?B?U2VyZ2V5IFB vYmVyZXpvdnNraX k=?="
<Se************ *****@discussio ns.microsoft.co m>
| References: <fc************ *************@m snews.microsoft .com>
| Subject: RE: Misunderstandin g ConnectionStrin gs?
| Date: Mon, 9 Jan 2006 16:18:02 -0800
| Lines: 20
| Message-ID: <29************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA01.phx.gbl!T K2MSFTNGXA03.ph x.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3696 53
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| As I undestand, your TDS's are in a dll project? Just a thought -
you can
try
| to remove dllname.config file from the bin folder - I think then
ASP.Net
will
| use web.config...
|
| "Shawn Wildermuth" wrote:
|
| > I have a web project whose web.config has a ConnectionStrin g
setup. I
have
| > a second assembly with my Typed DataSets. The designer has
created an
App.config
| > file with a connection string in it for the designer to use. The
web
project
| > referecnes the data assembly with the TDS's in it. When I deploy
this
project,
| > my Typed DataSets are still using the data in the app.config, and
not
the
| > one in the web.config. Any idea on how to tell it to get the
ConnectionStrin g
| > data from web.config and ignore the app.config?
| >
| > Shawn Wildermuth
| > C# MVP, Author and Speaker
| > http://adoguy.com
| >
| >
| >
|

Jan 10 '06 #5
Shawn,

We used the following code to read from the web.config from inside a dll:

string abc_setting = ConfigurationSe ttings.AppSetti ngs["abc_settin g"];

and it works as long as abc_setting is defined in web.config as follows:

<configuratio n>
..
<appSettings>
....
<add key="abc_settin g" value="abc"/>
</appSettings>
....
</configuration>

"Shawn Wildermuth" wrote:
Hello Sergey,

No app.config in the bin folder...what it was is that they are pre-pending
the project name to the connection string, e.g. MyCOmpany.MyAss embly.Settings. SomeOtherStuff. ConnectionStrin gName.
NO way I can tell to have the dll not create all that namespace clutter
so I had to create a second conneciton string in my web.config:

<connectionStri ng name="myConnStr ing" ... />
<connectionStri ng name="MyCompany .MyAssembly.Set tings.SomeOther Stuff.myConnStr ing"
.... />

To make it work. I don't like this solution so if someone knows how to specify
a realisticly named Connection String in the Table Adapter, I'd appreciate
it.

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com
As I undestand, your TDS's are in a dll project? Just a thought - you
can try to remove dllname.config file from the bin folder - I think
then ASP.Net will use web.config...

"Shawn Wildermuth" wrote:
I have a web project whose web.config has a ConnectionStrin g setup.
I have a second assembly with my Typed DataSets. The designer has
created an App.config file with a connection string in it for the
designer to use. The web project referecnes the data assembly with
the TDS's in it. When I deploy this project, my Typed DataSets are
still using the data in the app.config, and not the one in the
web.config. Any idea on how to tell it to get the ConnectionStrin g
data from web.config and ignore the app.config?

Shawn Wildermuth
C# MVP, Author and Speaker
http://adoguy.com


Jan 10 '06 #6
Thanks for your response Shawn,

As for the connectionstrin g name it is generated by the AppSettingBase
class's naming convention so as to avoid name clash when deploying to
target application(sin ce the client app could use many other components
.....). Also, if you do want to change the TableAdatper to use a customized
connection string , you can find the underlying code about the connection
intilization of the TableAdapter in the DataSet.Desiger .cs file which is
genernated by IDE, but we do not recommend this since IDE manage these code
and our customization could be override by IDE when performing some changes
through DESIGN TIME view....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Message-ID: <fc************ *************@m snews.microsoft .com>
| From: Shawn Wildermuth <sw*********@ad oguy.com>
| Subject: RE: Misunderstandin g ConnectionStrin gs?
| References: <gB************ **@TK2MSFTNGXA0 2.phx.gbl>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Reader 671.6
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Date: Mon, 09 Jan 2006 18:39:33 -0800
| NNTP-Posting-Host: c-71-56-111-8.hsd1.ga.comca st.net 71.56.111.8
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP09.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3696 70
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hello Steven Cheng[MSFT],
|
| Please see my reply to Sergey. Is there a way to tell the app to use a
shorter
| connection string name? We only have one so naming it with the entire
setting
| container is a waste of space and mindshare.
|
| Shawn Wildermuth
| C# MVP, Author and Speaker
| http://adoguy.com
|
| > Thanks for Sergey's inputs.
| >
| > Hi Shawn,
| >
| > As Sergey has mentioned, when we create the TableAdapter(da taset) in a
| > class library project, the connection string setting is retrieved from
| > the Application Settings collection defined there. And actually the
| > application settings collection is persisted in app.config file... So
| > when we use the class library assembly in a end client application
| > (winform or asp.net), we can override those settings in teh
| > application's config file (app.config or web.config...). If we don't
| > override, they use those default values defined in class library...
| >
| > Hope helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | Thread-Topic: Misunderstandin g ConnectionStrin gs?
| > | thread-index: AcYVe1HDeeq1cHE lRLq4Owmrb9gwfA ==
| > | X-WBNR-Posting-Host: 202.7.176.134
| > | From: "=?Utf-8?B?U2VyZ2V5IFB vYmVyZXpvdnNraX k=?="
| > <Se************ *****@discussio ns.microsoft.co m>
| > | References: <fc************ *************@m snews.microsoft .com>
| > | Subject: RE: Misunderstandin g ConnectionStrin gs?
| > | Date: Mon, 9 Jan 2006 16:18:02 -0800
| > | Lines: 20
| > | Message-ID: <29************ *************** *******@microso ft.com>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| > | Path:
| > TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA01.phx.gbl!T K2MSFTNGXA03.ph x.gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3696 53
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | As I undestand, your TDS's are in a dll project? Just a thought -
| > you can
| > try
| > | to remove dllname.config file from the bin folder - I think then
| > ASP.Net
| > will
| > | use web.config...
| > |
| > | "Shawn Wildermuth" wrote:
| > |
| > | > I have a web project whose web.config has a ConnectionStrin g
| > setup. I
| > have
| > | > a second assembly with my Typed DataSets. The designer has
| > created an
| > App.config
| > | > file with a connection string in it for the designer to use. The
| > web
| > project
| > | > referecnes the data assembly with the TDS's in it. When I deploy
| > this
| > project,
| > | > my Typed DataSets are still using the data in the app.config, and
| > not
| > the
| > | > one in the web.config. Any idea on how to tell it to get the
| > ConnectionStrin g
| > | > data from web.config and ignore the app.config?
| > | >
| > | > Shawn Wildermuth
| > | > C# MVP, Author and Speaker
| > | > http://adoguy.com
| > | >
| > | >
| > | >
| > |

|
|

Jan 11 '06 #7

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

Similar topics

3
6175
by: Dave | last post by:
I am a user of the ConfigurationSettings.AppSettings("KeyName") in asp.net 1.1 so after reading about the new ConnectionStrings collection in "Intoducing Microsoft ASP.NET 2.0 by Dino Esposito on page 137 I excitedly started a demo project to try it out. I am getting an error in the editor. It's telling me that ConnectionStrings is not a member of System.Configuration.ConfigurationSettings. What am I doing wrong? Dave
4
1652
by: Andy Sutorius via DotNetMonster.com | last post by:
I am creating a custom sitemap and when I run the site I get the following error and the debugger trips on line 28 of the code below. Can someone explain why I am getting this error and how to correct it? Parser Error Message: The entry 'LocalSqlServer' has already been added. Source Error: Line 13: </appSettings> Line 14: <connectionStrings> Line 15: <add
0
1013
by: chaks7 | last post by:
Hi! I have a Web App developed for1.1. Now we migrated to 2.0. We have a base library/dll used by few applications. When we started working with 2.0; we started using the Middle-tier schema objects(rather strongly-typed objects for the middle-tier) that .Net 2.0 allows to design using VS 2005 GUI interface. I am refering to this blog post: http://weblogs.asp.net/scottgu/archive/2006/01/15/435498.aspx. The only caveat is VS 2005 GUI...
1
1699
by: Chuck P | last post by:
I am trying to encrypt the connectionStrings in Web.config with a custom provider. Works great for me, anyone else tries it they get errors. Note the error says "decrypt" My statements I ran on the IIS server to create the key is: aspnet_regiis -pz WebEncryptionKeys aspnet_regiis -pc WebEncryptionKeys -exp
1
1454
by: Peter | last post by:
I found one aspx page in a PC for ASPX learning, in one web control, <asp:SqlDataSource>, one of its attribute is as below: ConnectionString=<%$ConnectionStrings:Northwind %> The page works. And apparently, <%$ConnectionString:Northwind%> has the database credential information. But, I do not know how it is defined. Please advise. Thanks. Peter
1
12686
by: shapper | last post by:
Hello, I create a few VB classes under app_code of a web site. Now I am trying to create a library project. Something strange is going on. I have the following line: Dim connectionString As String = ConfigurationManager.ConnectionStrings(_ConnectionString).ConnectionString I get an error saying:
2
7286
by: Bragadiru | last post by:
Hi all, I want to add a new connection string to my webservice web.config file at runtime : ConnectionStringSettings connStringsSettings = new ConnectionStringSettings("sys_connection_string", myConnString); System.Configuration.Configuration cfgRootWebConfig = WebConfigurationManager.OpenWebConfiguration(null);
2
3877
by: rmgalante | last post by:
I encrypted my connectionStrings section with the following command. aspnet_regiis -pef "connectionStrings" "C:\Inetpub\wwwroot \MyVirtualDirectory" It worked and I can see that the connectionStrings section in the web.config file has been encrypted. However, when I run the application it fails to load and displays a generic error message page with no details. This page tells me that I need to change my customErrors section in order...
0
3028
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i work on winxp with Net2 ver 2.0.50727 in the IIS (under ASP.NET) in my web.config file i have : <configuration> <connectionStrings> <add name="local_con" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=False;User Id=xxx;Password=xxxx;database=db1" providerName="System.Data.SqlClient" />
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.