473,398 Members | 2,404 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,398 software developers and data experts.

Passing the connection string from a web form to a business logic component

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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM FROM
CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that is
present in the web.config file. I tried using a constructor in that business
class but with no success. Also I have read that ObjectDataSource uses
stateless components so I think the usage of properties isn't allowed here.

The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class to
access web.config file.

Thanks a lot
Jaime
Nov 19 '05 #1
19 2501
if you have it in Web.Config like:-
<add key="ConnectionString" value="server=(local);database=YourDB;integrated
security=true;" />
Then in you app do:-
myconnection = New
SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Is that what you are looking for.
Patrick
"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM FROM CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that is
present in the web.config file. I tried using a constructor in that business class but with no success. Also I have read that ObjectDataSource uses
stateless components so I think the usage of properties isn't allowed here.
The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class to access web.config file.

Thanks a lot
Jaime

Nov 19 '05 #2
the best solution is to write you own application setting class (use
interfaces). this allows multiple implementation of loading settings, but
one for reading.

hint: use the factory model to allow a static create method.

-- bruce (sqlwork.com)

"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
FROM CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that is
present in the web.config file. I tried using a constructor in that
business class but with no success. Also I have read that ObjectDataSource
uses stateless components so I think the usage of properties isn't allowed
here.

The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class
to access web.config file.

Thanks a lot
Jaime

Nov 19 '05 #3
Hi Patrick..

I cannot do that since this method is in a DLL that is referenced by the
ASP.NET project. When I use AppSettings from the component, I receive a
null. However I think I could use what you suggested if I have public
DataSet GetCategories(String connectionStr).

By the way, I use ASP.NET 2.0 and in this version
ConfigurationSettings.AppSettings is reported as obsolete. I should use
ConfigurationManager.AppSettings instead.

Jaime

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl...
if you have it in Web.Config like:-
<add key="ConnectionString"
value="server=(local);database=YourDB;integrated
security=true;" />
Then in you app do:-
myconnection = New
SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Is that what you are looking for.
Patrick
"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM

FROM
CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that is
present in the web.config file. I tried using a constructor in that

business
class but with no success. Also I have read that ObjectDataSource uses
stateless components so I think the usage of properties isn't allowed

here.

The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class

to
access web.config file.

Thanks a lot
Jaime


Nov 19 '05 #4
FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs
in 2.0 you must add a reference to System.configuration.dll. (I wasted a
lot of time trying to figure that out).

This is not necessary to do to use
System.Configuration.ConfigurationSettings.AppSett ings and I not sure why.
Can anyone explain?

Greg

"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:uM*************@TK2MSFTNGP14.phx.gbl...
Hi Patrick..

I cannot do that since this method is in a DLL that is referenced by the
ASP.NET project. When I use AppSettings from the component, I receive a
null. However I think I could use what you suggested if I have public
DataSet GetCategories(String connectionStr).

By the way, I use ASP.NET 2.0 and in this version
ConfigurationSettings.AppSettings is reported as obsolete. I should use
ConfigurationManager.AppSettings instead.

Jaime

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl...
if you have it in Web.Config like:-
<add key="ConnectionString"
value="server=(local);database=YourDB;integrated
security=true;" />
Then in you app do:-
myconnection = New
SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Is that what you are looking for.
Patrick
"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data
Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM

FROM
CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that
is
present in the web.config file. I tried using a constructor in that

business
class but with no success. Also I have read that ObjectDataSource uses
stateless components so I think the usage of properties isn't allowed

here.

The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class

to
access web.config file.

Thanks a lot
Jaime



Nov 19 '05 #5
Hi, Greg.

re:
Can anyone explain?
System.Configuration.ConfigurationSettings.AppSett ings
is a class in the System.Configuration namespace in system.dll.

System.Configuration.ConfigurationManager.AppSetti ngs isn't.

See :

http://www.asp.net/QUICKSTART/util/c....Configuration

Configuration.ConfigurationManager is a class which resides in
System.Configuration (in system.configuration.dll), not in system.dll
which is where Configuration.ConfigurationSettings.AppSettings resides.

It's a bit confusing because the System.Configuration first names seem the same,
but -just like you do with people- you need a first name *and* a last name
to identify individuals.

The System.Configuration class in System.dll is really System.System.Configuration
( notice the *two* "system" in the name ) but we don't have to identify the base
namespace because it's automatically imported in all aspx pages.

If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:ut*************@TK2MSFTNGP15.phx.gbl... FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs in 2.0 you
must add a reference to System.configuration.dll. (I wasted a lot of time trying to
figure that out).

This is not necessary to do to use
System.Configuration.ConfigurationSettings.AppSett ings and I not sure why. Can anyone
explain?

Greg

"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:uM*************@TK2MSFTNGP14.phx.gbl...
Hi Patrick..

I cannot do that since this method is in a DLL that is referenced by the ASP.NET
project. When I use AppSettings from the component, I receive a null. However I think I
could use what you suggested if I have public DataSet GetCategories(String
connectionStr).

By the way, I use ASP.NET 2.0 and in this version ConfigurationSettings.AppSettings is
reported as obsolete. I should use ConfigurationManager.AppSettings instead.

Jaime

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl...
if you have it in Web.Config like:-
<add key="ConnectionString" value="server=(local);database=YourDB;integrated
security=true;" />
Then in you app do:-
myconnection = New
SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Is that what you are looking for.
Patrick
"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
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 GetCategories()
{
SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
Catalog=XXXX;User ID=X;Password=Y");
SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
FROM
CATEGORIA ORDER BY CAT_NOM", conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}

I need to know what is the best way to pass the connection string that is
present in the web.config file. I tried using a constructor in that
business
class but with no success. Also I have read that ObjectDataSource uses
stateless components so I think the usage of properties isn't allowed
here.

The question is, the only solution I could implement is passing the
connection string as a parameter to GetCategories? is there another one?
Since this method resides in a DLL, I cannot use ConnectionManager class
to
access web.config file.

Thanks a lot
Jaime



Nov 19 '05 #6
'System' does not exist in the namespace 'System.Configuration'

I added C:\Windows\Microsoft.NET\Framework\v2.0.50727\Syst em.configuration.dll
I also added using System.Configuration;

Here is the line of code it errors on.
string sConnString =
System.Configuration.System.Configuration.Configur ationManager.AppSettings["dsn"];
For now, I'm staying with ConfigurationSettings and live with the warnings.
string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];
"Juan T. Llibre" wrote:
Hi, Greg.

re:
Can anyone explain?


System.Configuration.ConfigurationSettings.AppSett ings
is a class in the System.Configuration namespace in system.dll.

System.Configuration.ConfigurationManager.AppSetti ngs isn't.

See :

http://www.asp.net/QUICKSTART/util/c....Configuration

Configuration.ConfigurationManager is a class which resides in
System.Configuration (in system.configuration.dll), not in system.dll
which is where Configuration.ConfigurationSettings.AppSettings resides.

It's a bit confusing because the System.Configuration first names seem the same,
but -just like you do with people- you need a first name *and* a last name
to identify individuals.

The System.Configuration class in System.dll is really System.System.Configuration
( notice the *two* "system" in the name ) but we don't have to identify the base
namespace because it's automatically imported in all aspx pages.

If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:ut*************@TK2MSFTNGP15.phx.gbl...
FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs in 2.0 you
must add a reference to System.configuration.dll. (I wasted a lot of time trying to
figure that out).

This is not necessary to do to use
System.Configuration.ConfigurationSettings.AppSett ings and I not sure why. Can anyone
explain?

Greg

"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:uM*************@TK2MSFTNGP14.phx.gbl...
Hi Patrick..

I cannot do that since this method is in a DLL that is referenced by the ASP.NET
project. When I use AppSettings from the component, I receive a null. However I think I
could use what you suggested if I have public DataSet GetCategories(String
connectionStr).

By the way, I use ASP.NET 2.0 and in this version ConfigurationSettings.AppSettings is
reported as obsolete. I should use ConfigurationManager.AppSettings instead.

Jaime

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl...
if you have it in Web.Config like:-
<add key="ConnectionString" value="server=(local);database=YourDB;integrated
security=true;" />
Then in you app do:-
myconnection = New
SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Is that what you are looking for.
Patrick
"Jaime Stuardo" <js******@manquehue.net> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl...
> 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 GetCategories()
> {
> SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
> Catalog=XXXX;User ID=X;Password=Y");
> SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
FROM
> CATEGORIA ORDER BY CAT_NOM", conn);
> DataSet ds = new DataSet();
> adapter.Fill(ds);
> return ds;
> }
>
> I need to know what is the best way to pass the connection string that is
> present in the web.config file. I tried using a constructor in that
business
> class but with no success. Also I have read that ObjectDataSource uses
> stateless components so I think the usage of properties isn't allowed
here.
>
> The question is, the only solution I could implement is passing the
> connection string as a parameter to GetCategories? is there another one?
> Since this method resides in a DLL, I cannot use ConnectionManager class
to
> access web.config file.
>
> Thanks a lot
> Jaime
>
>



Nov 19 '05 #7
Just import system.configuration and use :
string sConnString = System.Configuration.ConfigurationManager.AppSetti ngs["dsn"];

The thing is that the ConfigurationManager class isn't meant to be used
just to read a key and insert the key's string value into a connection.

It's meant to be used to *modify* configuration files.

If you just want to read a value in web.config, use :
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Mike L" <Ca***@nospam.nospam> wrote in message
news:F1**********************************@microsof t.com...
'System' does not exist in the namespace 'System.Configuration'

I added C:\Windows\Microsoft.NET\Framework\v2.0.50727\Syst em.configuration.dll
I also added using System.Configuration;

Here is the line of code it errors on.
string sConnString =
System.Configuration.System.Configuration.Configur ationManager.AppSettings["dsn"];
For now, I'm staying with ConfigurationSettings and live with the warnings.
string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];
"Juan T. Llibre" wrote:
Hi, Greg.

re:
> Can anyone explain?


System.Configuration.ConfigurationSettings.AppSett ings
is a class in the System.Configuration namespace in system.dll.

System.Configuration.ConfigurationManager.AppSetti ngs isn't.

See :

http://www.asp.net/QUICKSTART/util/c....Configuration

Configuration.ConfigurationManager is a class which resides in
System.Configuration (in system.configuration.dll), not in system.dll
which is where Configuration.ConfigurationSettings.AppSettings resides.

It's a bit confusing because the System.Configuration first names seem the same,
but -just like you do with people- you need a first name *and* a last name
to identify individuals.

The System.Configuration class in System.dll is really System.System.Configuration
( notice the *two* "system" in the name ) but we don't have to identify the base
namespace because it's automatically imported in all aspx pages.

If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:ut*************@TK2MSFTNGP15.phx.gbl...
> FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs in 2.0 you
> must add a reference to System.configuration.dll. (I wasted a lot of time trying to
> figure that out).
>
> This is not necessary to do to use
> System.Configuration.ConfigurationSettings.AppSett ings and I not sure why. Can anyone
> explain?
>
> Greg
>
> "Jaime Stuardo" <js******@manquehue.net> wrote in message
> news:uM*************@TK2MSFTNGP14.phx.gbl...
>> Hi Patrick..
>>
>> I cannot do that since this method is in a DLL that is referenced by the ASP.NET
>> project. When I use AppSettings from the component, I receive a null. However I
>> think I
>> could use what you suggested if I have public DataSet GetCategories(String
>> connectionStr).
>>
>> By the way, I use ASP.NET 2.0 and in this version ConfigurationSettings.AppSettings
>> is
>> reported as obsolete. I should use ConfigurationManager.AppSettings instead.
>>
>> Jaime
>>
>> "Patrick.O.Ige" <na********@hotmail.com> wrote in message
>> news:em**************@TK2MSFTNGP12.phx.gbl...
>>> if you have it in Web.Config like:-
>>> <add key="ConnectionString" value="server=(local);database=YourDB;integrated
>>> security=true;" />
>>> Then in you app do:-
>>> myconnection = New
>>> SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
>>> Is that what you are looking for.
>>> Patrick
>>>
>>>
>>> "Jaime Stuardo" <js******@manquehue.net> wrote in message
>>> news:ef**************@TK2MSFTNGP14.phx.gbl...
>>>> 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 GetCategories()
>>>> {
>>>> SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
>>>> Catalog=XXXX;User ID=X;Password=Y");
>>>> SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
>>> FROM
>>>> CATEGORIA ORDER BY CAT_NOM", conn);
>>>> DataSet ds = new DataSet();
>>>> adapter.Fill(ds);
>>>> return ds;
>>>> }
>>>>
>>>> I need to know what is the best way to pass the connection string that is
>>>> present in the web.config file. I tried using a constructor in that
>>> business
>>>> class but with no success. Also I have read that ObjectDataSource uses
>>>> stateless components so I think the usage of properties isn't allowed
>>> here.
>>>>
>>>> The question is, the only solution I could implement is passing the
>>>> connection string as a parameter to GetCategories? is there another one?
>>>> Since this method resides in a DLL, I cannot use ConnectionManager class
>>> to
>>>> access web.config file.
>>>>
>>>> Thanks a lot
>>>> Jaime
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Nov 19 '05 #8
> If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.
Not really. I guess I'm a little dense. :^)

This, of course, compiles just fine:
Dim sConnString As String =
System.Configuration.ConfigurationManager.AppSetti ngs("dsn")

and this (because System is imported by default in VB)
Dim sConnString As String =
Configuration.ConfigurationManager.AppSettings("ds n")

and if I import System.Configuation I would just use:
Imports System.Configuration
Dim sConnString As String = ConfigurationManager.AppSettings("dsn")

but now this won't compile: ?
Imports System.Configuration
Dim sConnString As String =
Configuration.ConfigurationManager.AppSettings("ds n")
Error: 'System' is not a member of 'System.Configuration.Configuration'

And I can't get this line to compile at all...?
Dim sConnString As String =
System.Configuration.System.Configuration.Configur ationManager.AppSettings("dsn")

Error: 'System' is not a member of 'Configuration'

I don't think I will ever completely understand this. Don't bother trying to
explain it to me again, I'm hopeless. :^)
The thing is that the ConfigurationManager class isn't meant to be used
just to read a key and insert the key's string value into a connection.

It's meant to be used to *modify* configuration files.

If you just want to read a value in web.config, use :
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];


Interesting, never heard that metioned before. I thought we were expected
to stop using System.Configuration.ConfigurationSettings.AppSett ings?

Greg

Nov 19 '05 #9
I'm reading a value from App.config
My project is a C# 2005 win form application.

Should I ignore the warring messages for "string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];" ?

"Juan T. Llibre" wrote:
Just import system.configuration and use :
string sConnString = System.Configuration.ConfigurationManager.AppSetti ngs["dsn"];

The thing is that the ConfigurationManager class isn't meant to be used
just to read a key and insert the key's string value into a connection.

It's meant to be used to *modify* configuration files.

If you just want to read a value in web.config, use :
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Mike L" <Ca***@nospam.nospam> wrote in message
news:F1**********************************@microsof t.com...
'System' does not exist in the namespace 'System.Configuration'

I added C:\Windows\Microsoft.NET\Framework\v2.0.50727\Syst em.configuration.dll
I also added using System.Configuration;

Here is the line of code it errors on.
string sConnString =
System.Configuration.System.Configuration.Configur ationManager.AppSettings["dsn"];
For now, I'm staying with ConfigurationSettings and live with the warnings.
string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];
"Juan T. Llibre" wrote:
Hi, Greg.

re:
> Can anyone explain?

System.Configuration.ConfigurationSettings.AppSett ings
is a class in the System.Configuration namespace in system.dll.

System.Configuration.ConfigurationManager.AppSetti ngs isn't.

See :

http://www.asp.net/QUICKSTART/util/c....Configuration

Configuration.ConfigurationManager is a class which resides in
System.Configuration (in system.configuration.dll), not in system.dll
which is where Configuration.ConfigurationSettings.AppSettings resides.

It's a bit confusing because the System.Configuration first names seem the same,
but -just like you do with people- you need a first name *and* a last name
to identify individuals.

The System.Configuration class in System.dll is really System.System.Configuration
( notice the *two* "system" in the name ) but we don't have to identify the base
namespace because it's automatically imported in all aspx pages.

If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:ut*************@TK2MSFTNGP15.phx.gbl...
> FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs in 2.0 you
> must add a reference to System.configuration.dll. (I wasted a lot of time trying to
> figure that out).
>
> This is not necessary to do to use
> System.Configuration.ConfigurationSettings.AppSett ings and I not sure why. Can anyone
> explain?
>
> Greg
>
> "Jaime Stuardo" <js******@manquehue.net> wrote in message
> news:uM*************@TK2MSFTNGP14.phx.gbl...
>> Hi Patrick..
>>
>> I cannot do that since this method is in a DLL that is referenced by the ASP.NET
>> project. When I use AppSettings from the component, I receive a null. However I
>> think I
>> could use what you suggested if I have public DataSet GetCategories(String
>> connectionStr).
>>
>> By the way, I use ASP.NET 2.0 and in this version ConfigurationSettings.AppSettings
>> is
>> reported as obsolete. I should use ConfigurationManager.AppSettings instead.
>>
>> Jaime
>>
>> "Patrick.O.Ige" <na********@hotmail.com> wrote in message
>> news:em**************@TK2MSFTNGP12.phx.gbl...
>>> if you have it in Web.Config like:-
>>> <add key="ConnectionString" value="server=(local);database=YourDB;integrated
>>> security=true;" />
>>> Then in you app do:-
>>> myconnection = New
>>> SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
>>> Is that what you are looking for.
>>> Patrick
>>>
>>>
>>> "Jaime Stuardo" <js******@manquehue.net> wrote in message
>>> news:ef**************@TK2MSFTNGP14.phx.gbl...
>>>> 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 GetCategories()
>>>> {
>>>> SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
>>>> Catalog=XXXX;User ID=X;Password=Y");
>>>> SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
>>> FROM
>>>> CATEGORIA ORDER BY CAT_NOM", conn);
>>>> DataSet ds = new DataSet();
>>>> adapter.Fill(ds);
>>>> return ds;
>>>> }
>>>>
>>>> I need to know what is the best way to pass the connection string that is
>>>> present in the web.config file. I tried using a constructor in that
>>> business
>>>> class but with no success. Also I have read that ObjectDataSource uses
>>>> stateless components so I think the usage of properties isn't allowed
>>> here.
>>>>
>>>> The question is, the only solution I could implement is passing the
>>>> connection string as a parameter to GetCategories? is there another one?
>>>> Since this method resides in a DLL, I cannot use ConnectionManager class
>>> to
>>>> access web.config file.
>>>>
>>>> Thanks a lot
>>>> Jaime
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Nov 19 '05 #10
Well, other than an obvious typo, it's a sound explanation.

If you need to verify, download Lutz Roeder's Reflector:
http://www.aisto.com/roeder/dotnet/
and take a look at both assemblies : System.dll and System.configuration.dll

You'll understand what I meant immediately.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:eW**************@TK2MSFTNGP09.phx.gbl...
If you want to use the ConfigurationManager.AppSettings class which is
a part of system.configuration.dll without importing the namespace,
you'll need to use its full name :

System.Configuration.System.Configuration.Configur ationManager.AppSettings

That because the System.Configuration.System.Configuration namespace
is *not* imported automatically into every aspx page.

I hope this is clearer to you now.


Not really. I guess I'm a little dense. :^)

This, of course, compiles just fine:
Dim sConnString As String = System.Configuration.ConfigurationManager.AppSetti ngs("dsn")

and this (because System is imported by default in VB)
Dim sConnString As String = Configuration.ConfigurationManager.AppSettings("ds n")

and if I import System.Configuation I would just use:
Imports System.Configuration
Dim sConnString As String = ConfigurationManager.AppSettings("dsn")

but now this won't compile: ?
Imports System.Configuration
Dim sConnString As String = Configuration.ConfigurationManager.AppSettings("ds n")
Error: 'System' is not a member of 'System.Configuration.Configuration'

And I can't get this line to compile at all...?
Dim sConnString As String =
System.Configuration.System.Configuration.Configur ationManager.AppSettings("dsn")

Error: 'System' is not a member of 'Configuration'

I don't think I will ever completely understand this. Don't bother trying to explain it
to me again, I'm hopeless. :^)
The thing is that the ConfigurationManager class isn't meant to be used
just to read a key and insert the key's string value into a connection.

It's meant to be used to *modify* configuration files.

If you just want to read a value in web.config, use :
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];


Interesting, never heard that metioned before. I thought we were expected to stop using
System.Configuration.ConfigurationSettings.AppSett ings?

Greg

Nov 19 '05 #11
re:
I'm reading a value from App.config
Isn't System.Configuration.ConfigurationSettings.AppSett ings
hard-wired to read from web.config if you're writing a web application?

Are you talking about a Windows Forms app.config ?

Windows applications in the .NET Framework use
the name app.config by default for their configuration file.

Web applications use web.config by default for the configuration file.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Mike L" <Ca***@nospam.nospam> wrote in message
news:D6**********************************@microsof t.com... I'm reading a value from App.config
My project is a C# 2005 win form application.

Should I ignore the warring messages for "string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];" ?

"Juan T. Llibre" wrote:
Just import system.configuration and use :
string sConnString = System.Configuration.ConfigurationManager.AppSetti ngs["dsn"];

The thing is that the ConfigurationManager class isn't meant to be used
just to read a key and insert the key's string value into a connection.

It's meant to be used to *modify* configuration files.

If you just want to read a value in web.config, use :
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Mike L" <Ca***@nospam.nospam> wrote in message
news:F1**********************************@microsof t.com...
> 'System' does not exist in the namespace 'System.Configuration'
>
> I added C:\Windows\Microsoft.NET\Framework\v2.0.50727\Syst em.configuration.dll
> I also added using System.Configuration;
>
> Here is the line of code it errors on.
> string sConnString =
> System.Configuration.System.Configuration.Configur ationManager.AppSettings["dsn"];
>
>
> For now, I'm staying with ConfigurationSettings and live with the warnings.
> string sConnString =
> System.Configuration.ConfigurationSettings.AppSett ings["dsn"];
>
>
> "Juan T. Llibre" wrote:
>
>> Hi, Greg.
>>
>> re:
>> > Can anyone explain?
>>
>> System.Configuration.ConfigurationSettings.AppSett ings
>> is a class in the System.Configuration namespace in system.dll.
>>
>> System.Configuration.ConfigurationManager.AppSetti ngs isn't.
>>
>> See :
>>
>> http://www.asp.net/QUICKSTART/util/c....Configuration
>>
>> Configuration.ConfigurationManager is a class which resides in
>> System.Configuration (in system.configuration.dll), not in system.dll
>> which is where Configuration.ConfigurationSettings.AppSettings resides.
>>
>> It's a bit confusing because the System.Configuration first names seem the same,
>> but -just like you do with people- you need a first name *and* a last name
>> to identify individuals.
>>
>> The System.Configuration class in System.dll is really System.System.Configuration
>> ( notice the *two* "system" in the name ) but we don't have to identify the base
>> namespace because it's automatically imported in all aspx pages.
>>
>> If you want to use the ConfigurationManager.AppSettings class which is
>> a part of system.configuration.dll without importing the namespace,
>> you'll need to use its full name :
>>
>> System.Configuration.System.Configuration.Configur ationManager.AppSettings
>>
>> That because the System.Configuration.System.Configuration namespace
>> is *not* imported automatically into every aspx page.
>>
>> I hope this is clearer to you now.
>>
>>
>>
>> Juan T. Llibre, ASP.NET MVP
>> ASP.NET FAQ : http://asp.net.do/faq/
>> ASPNETFAQ.COM : http://www.aspnetfaq.com/
>> Foros de ASP.NET en Español : http://asp.net.do/foros/
>> ======================================
>> "Greg Burns" <bl*******@newsgroups.nospam> wrote in message
>> news:ut*************@TK2MSFTNGP15.phx.gbl...
>> > FYI, to actually use System.Configuration.ConfigurationManager.AppSetti ngs in 2.0
>> > you
>> > must add a reference to System.configuration.dll. (I wasted a lot of time trying
>> > to
>> > figure that out).
>> >
>> > This is not necessary to do to use
>> > System.Configuration.ConfigurationSettings.AppSett ings and I not sure why. Can
>> > anyone
>> > explain?
>> >
>> > Greg
>> >
>> > "Jaime Stuardo" <js******@manquehue.net> wrote in message
>> > news:uM*************@TK2MSFTNGP14.phx.gbl...
>> >> Hi Patrick..
>> >>
>> >> I cannot do that since this method is in a DLL that is referenced by the ASP.NET
>> >> project. When I use AppSettings from the component, I receive a null. However I
>> >> think I
>> >> could use what you suggested if I have public DataSet GetCategories(String
>> >> connectionStr).
>> >>
>> >> By the way, I use ASP.NET 2.0 and in this version
>> >> ConfigurationSettings.AppSettings
>> >> is
>> >> reported as obsolete. I should use ConfigurationManager.AppSettings instead.
>> >>
>> >> Jaime
>> >>
>> >> "Patrick.O.Ige" <na********@hotmail.com> wrote in message
>> >> news:em**************@TK2MSFTNGP12.phx.gbl...
>> >>> if you have it in Web.Config like:-
>> >>> <add key="ConnectionString" value="server=(local);database=YourDB;integrated
>> >>> security=true;" />
>> >>> Then in you app do:-
>> >>> myconnection = New
>> >>> SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
>> >>> Is that what you are looking for.
>> >>> Patrick
>> >>>
>> >>>
>> >>> "Jaime Stuardo" <js******@manquehue.net> wrote in message
>> >>> news:ef**************@TK2MSFTNGP14.phx.gbl...
>> >>>> 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 GetCategories()
>> >>>> {
>> >>>> SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial
>> >>>> Catalog=XXXX;User ID=X;Password=Y");
>> >>>> SqlDataAdapter adapter = new SqlDataAdapter("SELECT CAT_ID, CAT_NOM
>> >>> FROM
>> >>>> CATEGORIA ORDER BY CAT_NOM", conn);
>> >>>> DataSet ds = new DataSet();
>> >>>> adapter.Fill(ds);
>> >>>> return ds;
>> >>>> }
>> >>>>
>> >>>> I need to know what is the best way to pass the connection string that is
>> >>>> present in the web.config file. I tried using a constructor in that
>> >>> business
>> >>>> class but with no success. Also I have read that ObjectDataSource uses
>> >>>> stateless components so I think the usage of properties isn't allowed
>> >>> here.
>> >>>>
>> >>>> The question is, the only solution I could implement is passing the
>> >>>> connection string as a parameter to GetCategories? is there another one?
>> >>>> Since this method resides in a DLL, I cannot use ConnectionManager class
>> >>> to
>> >>>> access web.config file.
>> >>>>
>> >>>> Thanks a lot
>> >>>> Jaime
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
>>


Nov 19 '05 #12

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Isn't System.Configuration.ConfigurationSettings.AppSett ings
hard-wired to read from web.config if you're writing a web application?

Are you talking about a Windows Forms app.config ?

Windows applications in the .NET Framework use
the name app.config by default for their configuration file.

Web applications use web.config by default for the configuration file.
ACK.

But what about his question?
Should I ignore the warring messages for "string sConnString =
System.Configuration.ConfigurationSettings.AppSet tings["dsn"];" ?


Sounds like you are saying you should ingore the warnings and continue to
use ConfigurationSettings.AppSettings for reading from web.config and
app.config files. This is the first time I've heard somebody suggest that.
I was under the impressions that ConfigurationSettings.AppSettings was
obsolete and should be avoided in favor of the new
ConfigurationManager.AppSettings.

Greg


Nov 19 '05 #13
re:
ConfigurationSettings.AppSettings was obsolete and should be avoided in favor of the new
ConfigurationManager.AppSettings
It is *deprecated*, not obsolete.

You can *still* read web.config values with ConfigurationSettings.AppSettings.

At some point in the future, though, it will stop working. (.Net Framework 3.0 ?)

re: Sounds like you are saying you should ingore the warnings and continue to use
ConfigurationSettings.AppSettings for reading from web.config and app.config files.
Like I said, app.config is for Windows Forms,
and web.config is for web applications.

He said he was using app.config, but this is a web applications newsgroup.

If he is getting warnings when he uses app.config in a web application,
then he should, simply, only use app.config for Windows applications,
and use web.config for web applications.

Otherwise, if he is using app.config in a Windows Application,
he should post to the right newsgroup for Windows apps, which is :

microsoft.public.dotnet.framework.windowsforms or any of its subgroups.

Is that clearer now ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Isn't System.Configuration.ConfigurationSettings.AppSett ings
hard-wired to read from web.config if you're writing a web application?
re: Are you talking about a Windows Forms app.config ?

Windows applications in the .NET Framework use
the name app.config by default for their configuration file.

Web applications use web.config by default for the configuration file.


ACK.

But what about his question?
Should I ignore the warring messages for "string sConnString =
System.Configuration.ConfigurationSettings.AppSe ttings["dsn"];" ?


Sounds like you are saying you should ingore the warnings and continue to use
ConfigurationSettings.AppSettings for reading from web.config and app.config files.
This is the first time I've heard somebody suggest that. I was under the impressions
that ConfigurationSettings.AppSettings was obsolete and should be avoided in favor of
the new ConfigurationManager.AppSettings.

Greg

Nov 19 '05 #14
inline

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
re:
ConfigurationSettings.AppSettings was obsolete and should be avoided in
favor of the new ConfigurationManager.AppSettings
It is *deprecated*, not obsolete.


The warning VS gives is "obsolete".
You can *still* read web.config values with
ConfigurationSettings.AppSettings.

At some point in the future, though, it will stop working. (.Net Framework
3.0 ?)

re:
Sounds like you are saying you should ingore the warnings and continue to
use ConfigurationSettings.AppSettings for reading from web.config and
app.config files.
Like I said, app.config is for Windows Forms,
and web.config is for web applications.


Yes, of course.
He said he was using app.config, but this is a web applications newsgroup.

If he is getting warnings when he uses app.config in a web application,
then he should, simply, only use app.config for Windows applications,
and use web.config for web applications.


You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings

Greg

Nov 19 '05 #15
re:
The warning VS gives is "obsolete".
It's still deprecated, not obsolete.

When something is obsolete, it doesn't works any more.
When something is deprecated, it still works.

re: You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings
I *never* get that warning neither in 1.1 nor in 2.0 web apps.
Maybe I'm just lucky ?

See an example at my test application, configured for ASP.NET 2.0:
http://asp.net.do/test/checkAppSettings.aspx

All that page has is :

checkAppSettings.aspx :
-------------------------
<script language="vb" runat="server">
Sub Page_Load()
Dim miSELECT as String = (ConfigurationSettings.AppSettings("selectDocs"))
setting.text = miSELECT
Dim miVersion as String = System.Environment.Version.ToString()
version.Text = "This application is running under ASP.NET version " & miVersion
End Sub
</script>
<html>
<head><title>Retrieve AppSetting key and ASP.NET Version</title></head>
<body>
<asp:label id="setting" runat="server" /><br/>
<asp:label id="version" runat="server" /><br/>
</body>
</html>
------------------------

The key in web.config reads like this :

<appSettings>
<add key="selectDocs" value="SELECT * FROM documents WHERE thereisdata ORDERBY
CreationDate DESC"/>
</appSettings>

Why am I not getting any warnings,
and why does that page compile OK if, as you say :
You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings
?


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:uT**************@TK2MSFTNGP09.phx.gbl... inline

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
re:
ConfigurationSettings.AppSettings was obsolete and should be avoided in favor of the
new ConfigurationManager.AppSettings


It is *deprecated*, not obsolete.


The warning VS gives is "obsolete".
You can *still* read web.config values with ConfigurationSettings.AppSettings.

At some point in the future, though, it will stop working. (.Net Framework 3.0 ?)

re:
Sounds like you are saying you should ingore the warnings and continue to use
ConfigurationSettings.AppSettings for reading from web.config and app.config files.


Like I said, app.config is for Windows Forms,
and web.config is for web applications.


Yes, of course.
He said he was using app.config, but this is a web applications newsgroup.

If he is getting warnings when he uses app.config in a web application,
then he should, simply, only use app.config for Windows applications,
and use web.config for web applications.


You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings

Greg

Nov 19 '05 #16

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
re:
The warning VS gives is "obsolete".
It's still deprecated, not obsolete.

When something is obsolete, it doesn't works any more.
When something is deprecated, it still works.


Okay, okay. :)

re:
You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings


I *never* get that warning neither in 1.1 nor in 2.0 web apps.
Maybe I'm just lucky ?


We'll you definately would never see it in 1.1, because this is a compiler
warning in VS 2005 for .NET 2.0.

No clue, why you don't see it in VS 2005. I see it in both my code bedhind
and in-line in the .aspx if I do like your example.

You must be lucky. :)

Did you perhaps turn off this warning in an option somewhere?

Greg
Nov 19 '05 #17
re:
We'll you definately would never see it in 1.1, because this is a compiler warning in VS
2005 for .NET 2.0.
It's a 2.0 app.

However, VS 2005, or the .Net compiler team, may be schizophrenic.

On the one hand VS 2005 says that a class is "obsolete",
but it runs OK and it compiles without errors.

Maybe the documentation guys flubbed this one ?

What the warning message should say is that the class
has been "deprecated", but that it compiles and runs OK.

When something is obsolete, it doesn't work any more.
When something is deprecated, it still works.

Not your fault, and not my fault, but I tend to take
these documentation flubs with a little grain of salt.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u$**************@TK2MSFTNGP09.phx.gbl...
re:
The warning VS gives is "obsolete".


It's still deprecated, not obsolete.

When something is obsolete, it doesn't works any more.
When something is deprecated, it still works.


Okay, okay. :)

re:
You get the warning in both Windows apps and Web apps when you use
ConfigurationSettings.AppSettings


I *never* get that warning neither in 1.1 nor in 2.0 web apps.
Maybe I'm just lucky ?


We'll you definately would never see it in 1.1, because this is a compiler warning in VS
2005 for .NET 2.0.

No clue, why you don't see it in VS 2005. I see it in both my code bedhind and in-line
in the .aspx if I do like your example.

You must be lucky. :)

Did you perhaps turn off this warning in an option somewhere?

Greg

Nov 19 '05 #18
Interesting read

http://www.gotdotnet.com/team/change...soletefaq.aspx

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uU**************@TK2MSFTNGP12.phx.gbl...
re:
We'll you definately would never see it in 1.1, because this is a
compiler warning in VS 2005 for .NET 2.0.


It's a 2.0 app.

However, VS 2005, or the .Net compiler team, may be schizophrenic.

On the one hand VS 2005 says that a class is "obsolete",
but it runs OK and it compiles without errors.

Maybe the documentation guys flubbed this one ?

What the warning message should say is that the class
has been "deprecated", but that it compiles and runs OK.

When something is obsolete, it doesn't work any more.
When something is deprecated, it still works.

Not your fault, and not my fault, but I tend to take
these documentation flubs with a little grain of salt.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================

Nov 19 '05 #19
Thanks, Greg.

Interesting, indeed.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Interesting read

http://www.gotdotnet.com/team/change...soletefaq.aspx

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uU**************@TK2MSFTNGP12.phx.gbl...
re:
We'll you definately would never see it in 1.1, because this is a compiler warning in
VS 2005 for .NET 2.0.


It's a 2.0 app.

However, VS 2005, or the .Net compiler team, may be schizophrenic.

On the one hand VS 2005 says that a class is "obsolete",
but it runs OK and it compiles without errors.

Maybe the documentation guys flubbed this one ?

What the warning message should say is that the class
has been "deprecated", but that it compiles and runs OK.

When something is obsolete, it doesn't work any more.
When something is deprecated, it still works.

Not your fault, and not my fault, but I tend to take
these documentation flubs with a little grain of salt.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================


Nov 19 '05 #20

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

Similar topics

11
by: Arsen Vladimirskiy | last post by:
Hello, If I have a few simple classes to represent Entities such as Customers and Orders. What is the proper way to pass information to the Data Access Layer? 1) Pass the actual ENTITY to...
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
1
by: Mythran | last post by:
I have 2 assemblies (for example). Assembly A references assembly B. If I have a value in assembly A that I want to be used in assembly B, how can I store it so that assembly B can access it...
25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
4
by: Jeff | last post by:
I have a main project which references several DLLs. Each DLL will access the same database as the main project. I'm storing the connection string within the main project's "web.config" file, so...
3
by: alaytin | last post by:
Hello- I am having a problem with a Web Service written in Visual Studio 2005. I have a typed dataset that I created using the Visual Studio 2005 Data Source tool. This retrieves its data from...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
3
by: Stimp | last post by:
I am creating a DLL in VS.NET that will be used on .net and asp websites. What is the best way to pass a SQL connection string into the class methods? I can't use the web.config method since...
2
by: grawsha2000 | last post by:
Greetings, I am developing this N-tier business app. The problem I'm facing is when I try to pass business objects (employees, dept..etc) from business tier to data tier,i.e., the add method in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.