Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Web config connection?

Web config connection?

Scheduled Pinned Locked Moved ASP.NET
helpquestionworkspace
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Karthick_gc
    wrote on last edited by
    #1

    Hi, I write connection coding in Web config file. The code is When i called it in the web form as con = new SqlConnection(ConfigurationManager.ConnectionString["conn"].ConnectionString); the following error appears. 'System.Configuration.ConfigurationManager' does not contain a definition for 'ConnectionString' Can any one tell whats the error?

    P J G 3 Replies Last reply
    0
    • K Karthick_gc

      Hi, I write connection coding in Web config file. The code is When i called it in the web form as con = new SqlConnection(ConfigurationManager.ConnectionString["conn"].ConnectionString); the following error appears. 'System.Configuration.ConfigurationManager' does not contain a definition for 'ConnectionString' Can any one tell whats the error?

      P Offline
      P Offline
      Padmanabh Ganorkar
      wrote on last edited by
      #2

      Hi, You have not posted the code you wrote in Web.config file. Secondly Please note and correct the syntax for accessing the connection string from web config in C#

      con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);

      Thanks Padmanabh

      1 Reply Last reply
      0
      • K Karthick_gc

        Hi, I write connection coding in Web config file. The code is When i called it in the web form as con = new SqlConnection(ConfigurationManager.ConnectionString["conn"].ConnectionString); the following error appears. 'System.Configuration.ConfigurationManager' does not contain a definition for 'ConnectionString' Can any one tell whats the error?

        J Offline
        J Offline
        Jack Li
        wrote on last edited by
        #3

        con = new SqlConnection(ConfigurationManager.ConnectionString["conn"].ConnectionString); This code contain two 'ConnectionString', So error appears does not contain a definition for 'ConnectionString' it's right: con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);

        1 Reply Last reply
        0
        • K Karthick_gc

          Hi, I write connection coding in Web config file. The code is When i called it in the web form as con = new SqlConnection(ConfigurationManager.ConnectionString["conn"].ConnectionString); the following error appears. 'System.Configuration.ConfigurationManager' does not contain a definition for 'ConnectionString' Can any one tell whats the error?

          G Offline
          G Offline
          gregor10
          wrote on last edited by
          #4

          very easy. Don't use the ConnectionStrings. Use ConfigurationManager.AppConfig["myconn1"] :-)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups