Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   q; connection string (http://www.velocityreviews.com/forums/t294487-q-connection-string.html)

=?Utf-8?B?SklNLkgu?= 05-22-2006 09:37 PM

q; connection string
 
Hello,

this code does not return connection string
string connStr =
ConfigurationManager.AppSettings["myDBConnectionString"];

app.config
<connectionStrings>
<add name="PVS.Properties.Settings.myDBConnectionString "
connectionString="Data Source=MyServer;Initial Catalog=myDB;User
ID=myUser;Password=myPassword"
providerName="System.Data.SqlClient" />
</connectionStrings>

What is wrong?


Will Asrari 05-22-2006 09:46 PM

Re: q; connection string
 
using System.Data.OleDb;

OleDbConnection cn = new
OleDbConnection(ConfigurationManager.AppSettings["myDBConnectionString"]);


Kevin Spencer 05-22-2006 09:48 PM

Re: q; connection string
 
Your Connection String is not in the AppSettings section of your app.config
file.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

The man who questions opinions is wise.
The man who quarrels with facts is a fool.

"JIM.H." <JIMH@discussions.microsoft.com> wrote in message
news:4AC9E556-8443-4F97-930D-738483CCD766@microsoft.com...
> Hello,
>
> this code does not return connection string
> string connStr =
> ConfigurationManager.AppSettings["myDBConnectionString"];
>
> app.config
> <connectionStrings>
> <add name="PVS.Properties.Settings.myDBConnectionString "
> connectionString="Data Source=MyServer;Initial
> Catalog=myDB;User
> ID=myUser;Password=myPassword"
> providerName="System.Data.SqlClient" />
> </connectionStrings>
>
> What is wrong?
>




MSDN 05-23-2006 12:05 AM

Re: q; connection string
 
<appSettings>

<add name="myDBConnectionString" value="Data Source=MyServer;Initial
Catalog=myDB;User ID=myUser;Password=myPassword" />

</appSettings>

string connStr = ConfigurationManager.AppSettings["myDBConnectionString"];


"JIM.H." <JIMH@discussions.microsoft.com> wrote in message
news:4AC9E556-8443-4F97-930D-738483CCD766@microsoft.com...
> Hello,
>
> this code does not return connection string
> string connStr =
> ConfigurationManager.AppSettings["myDBConnectionString"];
>
> app.config
> <connectionStrings>
> <add name="PVS.Properties.Settings.myDBConnectionString "
> connectionString="Data Source=MyServer;Initial
> Catalog=myDB;User
> ID=myUser;Password=myPassword"
> providerName="System.Data.SqlClient" />
> </connectionStrings>
>
> What is wrong?
>





All times are GMT. The time now is 08:03 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.