MS get the docs correct please please please

L

Lloyd Sheen

I am trying to extract string from web.config.

Example in MSDN has the following line:

Me.SqlConnection1.ConnectionString =
CType(System.Configuration.ConfigurationSettings.AppSettings.GetValues("SqlC
onnection1.ConnectionString")

No way this will compile. ASP really does not like this.

Complains about a Value of type '1-dimensional array of String' cannot be
converted to 'String'.

Any ideas. The more I use this the more I see that MS just did what the
absolute minimum is. No QA on docs and the docs get skimmpier each new
development tool.

LLoyd Sheen
 
S

Scott Allen

System.Configuration.ConfigurationSettings.AppSettings["SqlConnection1.ConnectionString"];

I'm curious where you found the example in the docs. GetValues, being
plural, implies it will return a collection of strings instead of a
single string.

HTH,
 
L

Lloyd Sheen

First my code is VB but it does not matter. The example is in MSDN. The
topic is

HOW TO: Store and Retrieve Custom Information from an Application
Configuration File by Using Visual Basic .NET

and there are other example equally useless.

Lloyd Sheen


Scott Allen said:
System.Configuration.ConfigurationSettings.AppSettings["SqlConnection1.Conne
ctionString"];

I'm curious where you found the example in the docs. GetValues, being
plural, implies it will return a collection of strings instead of a
single string.

HTH,

--
Scott
http://www.OdeToCode.com

I am trying to extract string from web.config.

Example in MSDN has the following line:

Me.SqlConnection1.ConnectionString =
CType(System.Configuration.ConfigurationSettings.AppSettings.GetValues("Sql
C
onnection1.ConnectionString")

No way this will compile. ASP really does not like this.

Complains about a Value of type '1-dimensional array of String' cannot be
converted to 'String'.

Any ideas. The more I use this the more I see that MS just did what the
absolute minimum is. No QA on docs and the docs get skimmpier each new
development tool.

LLoyd Sheen
 
C

Chris Jackson

I took a look at MSKB 313405 (HOW TO: Store and Retrieve Custom Information
from an Application Configuration File by Using Visual Basic .NET) and it's
code sample contains sAttr = ConfigurationSettings.AppSettings("Key0"),
which is exactly what you would want to do. In fact, the string GetValues
does not appear in this article at all. If you can give me the KB article
number of the article that provides erroneous code, I will do what I can to
get this fixed.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

Lloyd Sheen said:
First my code is VB but it does not matter. The example is in MSDN. The
topic is

HOW TO: Store and Retrieve Custom Information from an Application
Configuration File by Using Visual Basic .NET

and there are other example equally useless.

Lloyd Sheen


Scott Allen said:
System.Configuration.ConfigurationSettings.AppSettings["SqlConnection1.Conne
ctionString"];

I'm curious where you found the example in the docs. GetValues, being
plural, implies it will return a collection of strings instead of a
single string.

HTH,

--
Scott
http://www.OdeToCode.com

I am trying to extract string from web.config.

Example in MSDN has the following line:

Me.SqlConnection1.ConnectionString =
CType(System.Configuration.ConfigurationSettings.AppSettings.GetValues("Sql
C
onnection1.ConnectionString")

No way this will compile. ASP really does not like this.

Complains about a Value of type '1-dimensional array of String' cannot
be
converted to 'String'.

Any ideas. The more I use this the more I see that MS just did what the
absolute minimum is. No QA on docs and the docs get skimmpier each new
development tool.

LLoyd Sheen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top