ConnectionString not initialized..?

K

Kent Johnson

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;database=MyDB"/>
</appSettings>

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

What can be wrong?

/Kent J.
 
S

S. Justin Gengo

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
 
K

Kent Johnson

Everyting is just the same.
It worked yesterday.

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

Juan T. Llibre

re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;database=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... ;-)





Kent Johnson said:
Everyting is just the same.
It worked yesterday.

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


S. Justin Gengo said:
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
 
K

Kent Johnson

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 said:
re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;database=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... ;-)





Kent Johnson said:
Everyting is just the same.
It worked yesterday.

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


S. Justin Gengo said:
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
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;database=MyDB"/>
</appSettings>

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

What can be wrong?

/Kent J.
 
J

Juan T. Llibre

re:
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.






Kent Johnson said:
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 said:
re:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;database=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... ;-)





Kent Johnson said:
Everyting is just the same.
It worked yesterday.

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


message 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
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;database=MyDB"/>
</appSettings>

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

What can be wrong?

/Kent J.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top