473,473 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Getting Connection String from Web.Config in ASP.NET Express

I'm trying to get the frickin string out of the frickin config file
(using VB), but foundation classes don't seem to match the
documentation. Either I have this 30 line example where I walk a
collection fished out from nine levels down or I have a C# example
(Programming ASP.NET 2.0, Core Reference):

connstr =
ConfigurationManager.ConnectionStrings["NWind"].ConnectionString;

Which is nice but flat out doesn't match reality (but I sure wish it
did).

So how do you guys cope with this? PS: I'm trying to store the
connection in the application (Global.aspx) so I can reuse it. That's
how I used to do it in the old ASP days. Is that how it's still done?

Feb 14 '06 #1
1 1151
If you're using VB, change the brackets to parentheses. Otherwise, this is
how I get the ConnectionString out of the config file.

As for putting stuff in the GLOBAL.ASAX file, don't do it.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Mark" <mb****@bongo.net> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I'm trying to get the frickin string out of the frickin config file
(using VB), but foundation classes don't seem to match the
documentation. Either I have this 30 line example where I walk a
collection fished out from nine levels down or I have a C# example
(Programming ASP.NET 2.0, Core Reference):

connstr =
ConfigurationManager.ConnectionStrings["NWind"].ConnectionString;

Which is nice but flat out doesn't match reality (but I sure wish it
did).

So how do you guys cope with this? PS: I'm trying to store the
connection in the application (Global.aspx) so I can reuse it. That's
how I used to do it in the old ASP days. Is that how it's still done?

Feb 17 '06 #2

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

Similar topics

5
by: Mike | last post by:
I'm trying to connect to a SQL db, I have the db setup as a DSN on my machine, here is my connection string that i'm trying to use. string dbConn = "Provider=sqloeldb;data source=Tech;Initial...
2
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
7
by: Gary Brizard | last post by:
OK. For an n-tier architecture, where is the best place to store the connection string for the DA layer? I don't want to use the reg. Can't use a app.config for a dll. For other projects I...
1
by: amber | last post by:
Hello, I've just upgraded from .NET 2003 to 2005 and to SQL Server Express 2005. I've rebuilt my connection string. Before I used app.config, and now have the connection string is in the...
1
by: Chris Love | last post by:
I have already asked this, but no one seems to know the answer. Here is the timeline. I wanted to use the membership/roles functionality in a site. I got all sorts of errors trying to get this...
2
by: hfk0 | last post by:
Hi, I have a simple asp.net application running ok on my WinXP development server with SQL Server Express 2005 installed locally. After moving to the live server (Win 2000 server with MSDE 2000...
4
by: Matt Colegrove | last post by:
I'm working on a web app that is published to a hosting service. I'm developing it on my local PC with VS 2005 and SQL Express. The hosting service DB is SQL Server 2000. I have two...
3
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site...
12
by: Darrel | last post by:
I'm still having a hell of a time figuring out this whole SQL Express set up. I finally discovered why I couldn't run the aspnet_regsql...my local sql server wasn't running. I turned that on,...
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,...
1
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...
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.