By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,677 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,677 IT Pros & Developers. It's quick & easy.

ConnectionString not initialized..?

P: n/a
Hi all,

I have accidentally deleted my web.config file so I'll have to recreate it.

I have tried this in my Web.config file:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

When I run this I get:
"The ConnectionString property has not been initialized."

What can be wrong?

/Kent J.
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Kent,

In the connection string you just added are you certain your key name is the
same as the old one?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Kent Johnson" <08********@telia.com> wrote in message
news:6D*********************@newsc.telia.net...
Hi all,

I have accidentally deleted my web.config file so I'll have to recreate
it.

I have tried this in my Web.config file:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

When I run this I get:
"The ConnectionString property has not been initialized."

What can be wrong?

/Kent J.

Nov 19 '05 #2

P: n/a
Everyting is just the same.
It worked yesterday.

In page code behind:
string conn =
System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:eq*************@TK2MSFTNGP15.phx.gbl...
Kent,

In the connection string you just added are you certain your key name is the same as the old one?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Kent Johnson" <08********@telia.com> wrote in message
news:6D*********************@newsc.telia.net...
Hi all,

I have accidentally deleted my web.config file so I'll have to recreate
it.

I have tried this in my Web.config file:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

When I run this I get:
"The ConnectionString property has not been initialized."

What can be wrong?

/Kent J.


Nov 19 '05 #3

P: n/a
re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

Try :
<configuration>
<system.web>
<appSettings>
etc...

The appSettings key must be within <system.web>

btw, check Scott's great pointer on how to encapsulate
your configuration settings :

http://odetocode.com/Articles/345.aspx

Try it. There's more than one way to skin a cat... ;-)


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Kent Johnson" <08********@telia.com> wrote in message
news:LN*********************@newsc.telia.net...
Everyting is just the same.
It worked yesterday.

In page code behind:
string conn =
System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:eq*************@TK2MSFTNGP15.phx.gbl...
Kent,

In the connection string you just added are you certain your key name is

the
same as the old one?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Kent Johnson" <08********@telia.com> wrote in message
news:6D*********************@newsc.telia.net...
> Hi all,
>
> I have accidentally deleted my web.config file so I'll have to recreate
> it.
>
> I have tried this in my Web.config file:
> <configuration>
> <appSettings>
> <add key="ConnectionString"
> value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
> </appSettings>
>
> When I run this I get:
> "The ConnectionString property has not been initialized."
>
> What can be wrong?
>
> /Kent J.

Nov 19 '05 #4

P: n/a
OK! Great!
Now it works on my localhost!
What is the best way to export my project to production server?
File/Save as/http://MyServer/MyProject...?

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

Try :
<configuration>
<system.web>
<appSettings>
etc...

The appSettings key must be within <system.web>

btw, check Scott's great pointer on how to encapsulate
your configuration settings :

http://odetocode.com/Articles/345.aspx

Try it. There's more than one way to skin a cat... ;-)


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Kent Johnson" <08********@telia.com> wrote in message
news:LN*********************@newsc.telia.net...
Everyting is just the same.
It worked yesterday.

In page code behind:
string conn =
System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:eq*************@TK2MSFTNGP15.phx.gbl...
Kent,

In the connection string you just added are you certain your key name is
the
same as the old one?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Kent Johnson" <08********@telia.com> wrote in message
news:6D*********************@newsc.telia.net...
> Hi all,
>
> I have accidentally deleted my web.config file so I'll have to

recreate > it.
>
> I have tried this in my Web.config file:
> <configuration>
> <appSettings>
> <add key="ConnectionString"
> value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
> </appSettings>
>
> When I run this I get:
> "The ConnectionString property has not been initialized."
>
> What can be wrong?
>
> /Kent J.


Nov 19 '05 #5

P: n/a
re:
The appSettings key must be within <system.web> Now it works on my localhost!


Good to know!
Sometimes it's the little things which snag us.

:-)

re: What is the best way to export my project to production server?
I usually use "Copy Web", but there's quite a few ways to do that.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Kent Johnson" <08********@telia.com> wrote in message
news:f0*********************@newsc.telia.net... OK! Great!
Now it works on my localhost!
What is the best way to export my project to production server?
File/Save as/http://MyServer/MyProject...?

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
</appSettings>

Try :
<configuration>
<system.web>
<appSettings>
etc...

The appSettings key must be within <system.web>

btw, check Scott's great pointer on how to encapsulate
your configuration settings :

http://odetocode.com/Articles/345.aspx

Try it. There's more than one way to skin a cat... ;-)


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Kent Johnson" <08********@telia.com> wrote in message
news:LN*********************@newsc.telia.net...
> Everyting is just the same.
> It worked yesterday.
>
> In page code behind:
> string conn =
> System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"]; >
>
> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
> message news:eq*************@TK2MSFTNGP15.phx.gbl...
>> Kent,
>>
>> In the connection string you just added are you certain your key name is > the
>> same as the old one?
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "Kent Johnson" <08********@telia.com> wrote in message
>> news:6D*********************@newsc.telia.net...
>> > Hi all,
>> >
>> > I have accidentally deleted my web.config file so I'll have to recreate >> > it.
>> >
>> > I have tried this in my Web.config file:
>> > <configuration>
>> > <appSettings>
>> > <add key="ConnectionString"
>> > value="server=localhost;uid=sa;password=MyPwd;data base=MyDB"/>
>> > </appSettings>
>> >
>> > When I run this I get:
>> > "The ConnectionString property has not been initialized."
>> >
>> > What can be wrong?
>> >
>> > /Kent J.



Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.