Connection strings
- From: "Simon" <none@xxxxxxxx>
- Date: Sat, 29 Dec 2007 22:35:35 +0100
I have problems with connection strings. I have added new connection string to Web.config:
<connectionStrings>
<add name="ConnStr" connectionString="xxxxxxxxxxxxxxx"/>
</connectionStrings>
Bu when I want to access the data with:
coll = ConfigurationManager.ConnectionStrings;
connStr = coll[0].ConnectionString;
connStr = coll["ConnStr"].ConnectionString;
Second line returns:
"data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
And the third line return null reference exception.
Why? Is it not enough to change the connectionStrings section in project and this should work?
Thank you
Simon
.
- Follow-Ups:
- RE: Connection strings
- From: Steven Cheng[MSFT]
- RE: Connection strings
- Prev by Date: Connection strings?
- Next by Date: RE: Connection strings
- Previous by thread: Connection strings?
- Next by thread: RE: Connection strings
- Index(es):