Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ConnectionString not initialized..?

Reply
Thread Tools

ConnectionString not initialized..?

 
 
Kent Johnson
Guest
Posts: n/a
 
      10-01-2005
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.


 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      10-01-2005
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" <(E-Mail Removed)> wrote in message
news:6Dw%e.147416$(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
Kent Johnson
Guest
Posts: n/a
 
      10-01-2005
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:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:6Dw%e.147416$(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-01-2005
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" <(E-Mail Removed)> wrote in message
news:LNw%e.147417$(E-Mail Removed)...
> 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:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:6Dw%e.147416$(E-Mail Removed)...
>> > 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.



 
Reply With Quote
 
Kent Johnson
Guest
Posts: n/a
 
      10-02-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:LNw%e.147417$(E-Mail Removed)...
> > 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:(E-Mail Removed)...
> >> 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" <(E-Mail Removed)> wrote in message
> >> news:6Dw%e.147416$(E-Mail Removed)...
> >> > 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.

>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-02-2005
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" <(E-Mail Removed)> wrote in message
news:f0R%e.147525$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:LNw%e.147417$(E-Mail Removed)...
>> > 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:(E-Mail Removed)...
>> >> 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" <(E-Mail Removed)> wrote in message
>> >> news:6Dw%e.147416$(E-Mail Removed)...
>> >> > 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.

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
The ConnectionString property has not been initialized. Laura K ASP .Net 12 05-15-2010 05:22 AM
Connectionstring User and Password Not Being Used =?Utf-8?B?REo=?= ASP .Net 3 06-22-2006 07:53 AM
ConfigurationSettings.ConnectionStrings("Personal").ConnectionString does not work Dave ASP .Net 3 11-29-2005 01:02 AM
Place connectionString in web.config. Why is not working? Shapper ASP .Net 2 04-23-2005 04:08 PM
ASP.net: Error "Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized." Tony ASP .Net 6 06-15-2004 09:27 AM



Advertisments