|
Subject:
|
question about "A better connection string"
|
|
Posted By:
|
vinny
|
Post Date:
|
12/22/2003 6:38:56 PM
|
RE: A better connection string", Chapter 3, pg. 91 and 92:
I used this in a project and Configuation.Setting was underlined in blue. I was able to make it work by adding - "Imports System.Configuration" to the .vb file. My question is why was this neccesary and is this the proper way to deal with this?
Thanks, Vince
|
|
Reply By:
|
Imar
|
Reply Date:
|
12/23/2003 3:46:38 AM
|
Yes, that is correct. ConfigurationSettings lives in the System.Configuarion Namespace. To tell the compiler where it should look for the ConfigurationSettings class, you need to import the correct namespace.
Another way to do this, is to use the full name of the class. For example:
System.Configuration.ConfigurationSettings.AppSettings.Get("MyDefaultDatabase")
This would get the value of the key MyDefaultDatabase from the config file.
Either the authors of the book forgot the Imports statement, or they have imported this namespace by default on the Property Pages of the VB project.
HtH,
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|
|
Reply By:
|
stu9820
|
Reply Date:
|
1/12/2004 11:01:29 AM
|
The System.Configuration is automatically available by default and you do not need to import it.
|
|
Reply By:
|
Imar
|
Reply Date:
|
1/12/2004 11:28:37 AM
|
Hmmm true. Didn't know that.
Makes you wonder what went wrong in the situation of the OP.
Vince, what kind of project did you use the code in? A Web Project or a Class Library?
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|
|
Reply By:
|
stu9820
|
Reply Date:
|
1/12/2004 1:24:44 PM
|
Can the JIT compiler create the dll needed to run a web app?
|