Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

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

 
Thread Tools Search this Thread
Old 02-14-2006, 12:35 AM   #1
Default 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?



Mark
  Reply With Quote
Old 02-17-2006, 03:43 AM   #2
Christopher Reed
 
Posts: n/a
Default Re: Getting Connection String from Web.Config in ASP.NET Express
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" <> wrote in message
news: 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?
>





Christopher Reed
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Give you enough string functions in Java web reporting tool freezea Software 0 10-08-2009 09:03 AM
Java String Problems rbnbenjamin General Help Related Topics 0 02-03-2009 11:02 PM
Connection string Rucheekaa Software 0 06-14-2008 04:02 AM
ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) msandlana Software 0 04-25-2008 06:37 AM
How to configure VPN hi5 Hardware 1 07-09-2007 12:21 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46