q; connection string

Discussion in 'ASP .Net' started by =?Utf-8?B?SklNLkgu?=, May 22, 2006.

  1. 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?
     
    =?Utf-8?B?SklNLkgu?=, May 22, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?SklNLkgu?=

    Will Asrari Guest

    using System.Data.OleDb;

    OleDbConnection cn = new
    OleDbConnection(ConfigurationManager.AppSettings["myDBConnectionString"]);
     
    Will Asrari, May 22, 2006
    #2
    1. Advertising

  3. 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." <> wrote in message
    news:...
    > 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?
    >
     
    Kevin Spencer, May 22, 2006
    #3
  4. =?Utf-8?B?SklNLkgu?=

    MSDN Guest

    <appSettings>

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

    </appSettings>

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


    "JIM.H." <> wrote in message
    news:...
    > 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, May 23, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gaurav
    Replies:
    0
    Views:
    16,157
    Gaurav
    Nov 7, 2003
  2. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    Connection String object Convert to String Variable Type

    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Oct 26, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,076
    Norman Yuan
    Oct 26, 2004
  3. Mythran
    Replies:
    5
    Views:
    4,970
    Mythran
    Oct 5, 2005
  4. Replies:
    3
    Views:
    853
    Samuel R. Neff
    Aug 3, 2007
  5. Wei  Lu
    Replies:
    2
    Views:
    5,918
    Wei Lu
    Feb 16, 2009
Loading...

Share This Page